Merge branch 'feature/feature_mogo_obu'

This commit is contained in:
董宏宇
2021-08-02 15:27:10 +08:00
3707 changed files with 522977 additions and 27647 deletions

View File

@@ -1,13 +1,11 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<option name="AUTODETECT_INDENTS" value="false" />
<JavaCodeStyleSettings>
<option name="FIELD_NAME_PREFIX" value="m" />
</JavaCodeStyleSettings>
<JetCodeStyleSettings>
<option name="PACKAGES_TO_USE_STAR_IMPORTS">
<value>
<package name="java.util" withSubpackages="false" static="false" />
<package name="kotlinx.android.synthetic" withSubpackages="true" static="false" />
<package name="io.ktor" withSubpackages="true" static="false" />
</value>
</option>
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</JetCodeStyleSettings>
<codeStyleSettings language="XML">
<indentOptions>
@@ -121,5 +119,8 @@
</rules>
</arrangement>
</codeStyleSettings>
<codeStyleSettings language="kotlin">
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</codeStyleSettings>
</code_scheme>
</component>

32
.idea/gradle.xml generated
View File

@@ -4,37 +4,47 @@
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="delegatedBuild" value="true" />
<option name="testRunner" value="PLATFORM" />
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="1.8" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/OCH" />
<option value="$PROJECT_DIR$/OCH/mogo-och" />
<option value="$PROJECT_DIR$/OCH/mogo-och-bus" />
<option value="$PROJECT_DIR$/OCH/mogo-och-noop" />
<option value="$PROJECT_DIR$/OCH/mogo-och-taxi" />
<option value="$PROJECT_DIR$/app" />
<option value="$PROJECT_DIR$/foudations" />
<option value="$PROJECT_DIR$/foudations/mogo-base-services-apk" />
<option value="$PROJECT_DIR$/foudations/mogo-base-services-sdk" />
<option value="$PROJECT_DIR$/foudations/httpdns-base" />
<option value="$PROJECT_DIR$/foudations/httpdns-mogo" />
<option value="$PROJECT_DIR$/foudations/httpdns-noop" />
<option value="$PROJECT_DIR$/foudations/httpdns-tencent" />
<option value="$PROJECT_DIR$/foudations/mogo-aicloud-services-apk" />
<option value="$PROJECT_DIR$/foudations/mogo-aicloud-services-sdk" />
<option value="$PROJECT_DIR$/foudations/mogo-base-websocket-sdk" />
<option value="$PROJECT_DIR$/foudations/mogo-commons" />
<option value="$PROJECT_DIR$/foudations/mogo-utils" />
<option value="$PROJECT_DIR$/libraries" />
<option value="$PROJECT_DIR$/libraries/map-amap" />
<option value="$PROJECT_DIR$/libraries/map-autonavi" />
<option value="$PROJECT_DIR$/libraries/map-custom" />
<option value="$PROJECT_DIR$/libraries/mogo-map" />
<option value="$PROJECT_DIR$/libraries/mogo-map-api" />
<option value="$PROJECT_DIR$/libraries/mogo-tanlu-api" />
<option value="$PROJECT_DIR$/libraries/tanlulib" />
<option value="$PROJECT_DIR$/main-extensions" />
<option value="$PROJECT_DIR$/main-extensions/mogo-module-main-independent" />
<option value="$PROJECT_DIR$/main-extensions/mogo-module-main-launcher" />
<option value="$PROJECT_DIR$/modules" />
<option value="$PROJECT_DIR$/modules/mogo-module-adas" />
<option value="$PROJECT_DIR$/modules/mogo-module-apps" />
<option value="$PROJECT_DIR$/modules/mogo-module-authorize" />
<option value="$PROJECT_DIR$/modules/mogo-module-back" />
<option value="$PROJECT_DIR$/modules/mogo-module-common" />
<option value="$PROJECT_DIR$/modules/mogo-module-extensions" />
<option value="$PROJECT_DIR$/modules/mogo-module-gps-simulator" />
<option value="$PROJECT_DIR$/modules/mogo-module-gps-simulator-debug" />
<option value="$PROJECT_DIR$/modules/mogo-module-gps-simulator-noop" />
<option value="$PROJECT_DIR$/modules/mogo-module-guide" />
<option value="$PROJECT_DIR$/modules/mogo-module-left-panel" />
<option value="$PROJECT_DIR$/modules/mogo-module-left-panel-noop" />
@@ -49,9 +59,9 @@
<option value="$PROJECT_DIR$/modules/mogo-module-search" />
<option value="$PROJECT_DIR$/modules/mogo-module-service" />
<option value="$PROJECT_DIR$/modules/mogo-module-share" />
<option value="$PROJECT_DIR$/modules/mogo-module-smp" />
<option value="$PROJECT_DIR$/modules/mogo-module-splash" />
<option value="$PROJECT_DIR$/modules/mogo-module-splash-noop" />
<option value="$PROJECT_DIR$/modules/mogo-module-tanlu" />
<option value="$PROJECT_DIR$/modules/mogo-module-v2x" />
<option value="$PROJECT_DIR$/modules/mogo-module-widgets" />
<option value="$PROJECT_DIR$/services" />
@@ -71,9 +81,17 @@
<option value="$PROJECT_DIR$/test/crashreport" />
<option value="$PROJECT_DIR$/test/crashreport-bugly" />
<option value="$PROJECT_DIR$/test/crashreport-noop" />
<option value="$PROJECT_DIR$/test/crashreport-upgrade" />
<option value="$PROJECT_DIR$/tts" />
<option value="$PROJECT_DIR$/tts/tts-base" />
<option value="$PROJECT_DIR$/tts/tts-di" />
<option value="$PROJECT_DIR$/tts/tts-noop" />
<option value="$PROJECT_DIR$/tts/tts-pad" />
<option value="$PROJECT_DIR$/tts/tts-zhi" />
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
<option name="useQualifiedModuleNames" value="true" />
</GradleProjectSettings>
</option>
</component>

View File

@@ -0,0 +1,36 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="JavaDoc" enabled="true" level="WARNING" enabled_by_default="true">
<option name="TOP_LEVEL_CLASS_OPTIONS">
<value>
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
<option name="REQUIRED_TAGS" value="" />
</value>
</option>
<option name="INNER_CLASS_OPTIONS">
<value>
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
<option name="REQUIRED_TAGS" value="" />
</value>
</option>
<option name="METHOD_OPTIONS">
<value>
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
<option name="REQUIRED_TAGS" value="@return@param@throws or @exception" />
</value>
</option>
<option name="FIELD_OPTIONS">
<value>
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
<option name="REQUIRED_TAGS" value="" />
</value>
</option>
<option name="IGNORE_DEPRECATED" value="false" />
<option name="IGNORE_JAVADOC_PERIOD" value="true" />
<option name="IGNORE_DUPLICATED_THROWS" value="false" />
<option name="IGNORE_POINT_TO_ITSELF" value="false" />
<option name="myAdditionalJavadocTags" value="date" />
</inspection_tool>
</profile>
</component>

13
.idea/misc.xml generated
View File

@@ -1,10 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ASMIdeaPluginConfiguration">
<asm skipDebug="false" skipFrames="false" skipCode="false" expandFrames="false" />
<groovy codeStyle="LEGACY" />
</component>
<component name="ASMPluginConfiguration">
<asm skipDebug="false" skipFrames="false" skipCode="false" expandFrames="false" />
<groovy codeStyle="LEGACY" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<component name="DesignSurface">
<option name="filePathToZoomLevelMap">
<map>
<entry key="modules/mogo-module-map/src/main/res/layout/module_map_fragment_map.xml" value="0.202734375" />
</map>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="Embedded JDK" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
</project>

465
.idea/qaplug_profiles.xml generated Normal file
View File

@@ -0,0 +1,465 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AnalysisProjectProfileManager">
<option name="PROJECT_PROFILE" value="Project Default" />
<option name="USE_PROJECT_LEVEL_SETTINGS" value="false" />
<scopes />
<profiles>
<profile profile_name="Project Default" version="1.0" is_locked="false">
<coding_rule class="AM_CREATES_EMPTY_JAR_FILE_ENTRY" level="MAJOR" enabled="true" />
<coding_rule class="AM_CREATES_EMPTY_ZIP_FILE_ENTRY" level="MAJOR" enabled="true" />
<coding_rule class="AT_OPERATION_SEQUENCE_ON_CONCURRENT_ABSTRACTION" level="CRITICAL" enabled="false" />
<coding_rule class="BAC_BAD_APPLET_CONSTRUCTOR" level="MAJOR" enabled="false" />
<coding_rule class="BC_BAD_CAST_TO_ABSTRACT_COLLECTION" level="MAJOR" enabled="true" />
<coding_rule class="BC_BAD_CAST_TO_CONCRETE_COLLECTION" level="CRITICAL" enabled="true" />
<coding_rule class="BC_EQUALS_METHOD_SHOULD_WORK_FOR_ALL_OBJECTS" level="CRITICAL" enabled="true" />
<coding_rule class="BC_IMPOSSIBLE_CAST" level="BLOCKER" enabled="true" />
<coding_rule class="BC_IMPOSSIBLE_DOWNCAST" level="MAJOR" enabled="false" />
<coding_rule class="BC_IMPOSSIBLE_DOWNCAST_OF_TOARRAY" level="MAJOR" enabled="false" />
<coding_rule class="BC_IMPOSSIBLE_INSTANCEOF" level="CRITICAL" enabled="true" />
<coding_rule class="BC_UNCONFIRMED_CAST" level="CRITICAL" enabled="true" />
<coding_rule class="BC_UNCONFIRMED_CAST_OF_RETURN_VALUE" level="CRITICAL" enabled="false" />
<coding_rule class="BC_VACUOUS_INSTANCEOF" level="CRITICAL" enabled="true" />
<coding_rule class="BIT_ADD_OF_SIGNED_BYTE" level="CRITICAL" enabled="true" />
<coding_rule class="BIT_AND" level="CRITICAL" enabled="true" />
<coding_rule class="BIT_AND_ZZ" level="CRITICAL" enabled="true" />
<coding_rule class="BIT_IOR" level="CRITICAL" enabled="true" />
<coding_rule class="BIT_IOR_OF_SIGNED_BYTE" level="CRITICAL" enabled="true" />
<coding_rule class="BIT_SIGNED_CHECK" level="CRITICAL" enabled="true" />
<coding_rule class="BIT_SIGNED_CHECK_HIGH_BIT" level="CRITICAL" enabled="true" />
<coding_rule class="BOA_BADLY_OVERRIDDEN_ADAPTER" level="CRITICAL" enabled="true" />
<coding_rule class="BSHIFT_WRONG_ADD_PRIORITY" level="MAJOR" enabled="false" />
<coding_rule class="BX_BOXING_IMMEDIATELY_UNBOXED" level="MAJOR" enabled="true" />
<coding_rule class="BX_BOXING_IMMEDIATELY_UNBOXED_TO_PERFORM_COERCION" level="MAJOR" enabled="true" />
<coding_rule class="BX_UNBOXED_AND_COERCED_FOR_TERNARY_OPERATOR" level="MAJOR" enabled="true" />
<coding_rule class="BX_UNBOXING_IMMEDIATELY_REBOXED" level="CRITICAL" enabled="false" />
<coding_rule class="CAA_COVARIANT_ARRAY_ELEMENT_STORE" level="MAJOR" enabled="false" />
<coding_rule class="CAA_COVARIANT_ARRAY_FIELD" level="MAJOR" enabled="false" />
<coding_rule class="CAA_COVARIANT_ARRAY_LOCAL" level="MAJOR" enabled="false" />
<coding_rule class="CAA_COVARIANT_ARRAY_RETURN" level="MAJOR" enabled="false" />
<coding_rule class="CD_CIRCULAR_DEPENDENCY" level="MAJOR" enabled="false" />
<coding_rule class="CI_CONFUSED_INHERITANCE" level="MINOR" enabled="true" />
<coding_rule class="CNT_ROUGH_CONSTANT_VALUE" level="MAJOR" enabled="false" />
<coding_rule class="CN_IDIOM" level="MAJOR" enabled="true" />
<coding_rule class="CN_IDIOM_NO_SUPER_CALL" level="MAJOR" enabled="true" />
<coding_rule class="CN_IMPLEMENTS_CLONE_BUT_NOT_CLONEABLE" level="MAJOR" enabled="true" />
<coding_rule class="CO_ABSTRACT_SELF" level="MAJOR" enabled="true" />
<coding_rule class="CO_COMPARETO_INCORRECT_FLOATING" level="MAJOR" enabled="false" />
<coding_rule class="CO_COMPARETO_RESULTS_MIN_VALUE" level="CRITICAL" enabled="false" />
<coding_rule class="CO_SELF_NO_OBJECT" level="MAJOR" enabled="true" />
<coding_rule class="DB_DUPLICATE_BRANCHES" level="CRITICAL" enabled="true" />
<coding_rule class="DB_DUPLICATE_SWITCH_CLAUSES" level="CRITICAL" enabled="true" />
<coding_rule class="DC_DOUBLECHECK" level="MAJOR" enabled="true" />
<coding_rule class="DC_PARTIALLY_CONSTRUCTED" level="MAJOR" enabled="false" />
<coding_rule class="DE_MIGHT_DROP" level="MAJOR" enabled="true" />
<coding_rule class="DE_MIGHT_IGNORE" level="MAJOR" enabled="true" />
<coding_rule class="DLS_DEAD_LOCAL_INCREMENT_IN_RETURN" level="MAJOR" enabled="false" />
<coding_rule class="DLS_DEAD_LOCAL_STORE" level="CRITICAL" enabled="true" />
<coding_rule class="DLS_DEAD_LOCAL_STORE_IN_RETURN" level="CRITICAL" enabled="true" />
<coding_rule class="DLS_DEAD_LOCAL_STORE_OF_NULL" level="CRITICAL" enabled="true" />
<coding_rule class="DLS_DEAD_LOCAL_STORE_SHADOWS_FIELD" level="CRITICAL" enabled="false" />
<coding_rule class="DLS_DEAD_STORE_OF_CLASS_LITERAL" level="CRITICAL" enabled="true" />
<coding_rule class="DLS_OVERWRITTEN_INCREMENT" level="CRITICAL" enabled="true" />
<coding_rule class="DL_SYNCHRONIZATION_ON_BOOLEAN" level="CRITICAL" enabled="true" />
<coding_rule class="DL_SYNCHRONIZATION_ON_BOXED_PRIMITIVE" level="CRITICAL" enabled="true" />
<coding_rule class="DL_SYNCHRONIZATION_ON_SHARED_CONSTANT" level="CRITICAL" enabled="true" />
<coding_rule class="DL_SYNCHRONIZATION_ON_UNSHARED_BOXED_PRIMITIVE" level="CRITICAL" enabled="true" />
<coding_rule class="DMI_ANNOTATION_IS_NOT_VISIBLE_TO_REFLECTION" level="MAJOR" enabled="true" />
<coding_rule class="DMI_ARGUMENTS_WRONG_ORDER" level="CRITICAL" enabled="false" />
<coding_rule class="DMI_BAD_MONTH" level="CRITICAL" enabled="true" />
<coding_rule class="DMI_BIGDECIMAL_CONSTRUCTED_FROM_DOUBLE" level="CRITICAL" enabled="false" />
<coding_rule class="DMI_BLOCKING_METHODS_ON_URL" level="BLOCKER" enabled="true" />
<coding_rule class="DMI_CALLING_NEXT_FROM_HASNEXT" level="CRITICAL" enabled="true" />
<coding_rule class="DMI_COLLECTIONS_SHOULD_NOT_CONTAIN_THEMSELVES" level="CRITICAL" enabled="true" />
<coding_rule class="DMI_COLLECTION_OF_URLS" level="BLOCKER" enabled="true" />
<coding_rule class="DMI_CONSTANT_DB_PASSWORD" level="BLOCKER" enabled="true" />
<coding_rule class="DMI_DOH" level="CRITICAL" enabled="false" />
<coding_rule class="DMI_EMPTY_DB_PASSWORD" level="CRITICAL" enabled="true" />
<coding_rule class="DMI_ENTRY_SETS_MAY_REUSE_ENTRY_OBJECTS" level="CRITICAL" enabled="false" />
<coding_rule class="DMI_FUTILE_ATTEMPT_TO_CHANGE_MAXPOOL_SIZE_OF_SCHEDULED_THREAD_POOL_EXECUTOR" level="MINOR" enabled="true" />
<coding_rule class="DMI_HARDCODED_ABSOLUTE_FILENAME" level="CRITICAL" enabled="true" />
<coding_rule class="DMI_INVOKING_HASHCODE_ON_ARRAY" level="CRITICAL" enabled="true" />
<coding_rule class="DMI_INVOKING_TOSTRING_ON_ANONYMOUS_ARRAY" level="CRITICAL" enabled="true" />
<coding_rule class="DMI_INVOKING_TOSTRING_ON_ARRAY" level="CRITICAL" enabled="true" />
<coding_rule class="DMI_LONG_BITS_TO_DOUBLE_INVOKED_ON_INT" level="CRITICAL" enabled="true" />
<coding_rule class="DMI_NONSERIALIZABLE_OBJECT_WRITTEN" level="CRITICAL" enabled="true" />
<coding_rule class="DMI_RANDOM_USED_ONLY_ONCE" level="CRITICAL" enabled="true" />
<coding_rule class="DMI_SCHEDULED_THREAD_POOL_EXECUTOR_WITH_ZERO_CORE_THREADS" level="MINOR" enabled="true" />
<coding_rule class="DMI_THREAD_PASSED_WHERE_RUNNABLE_EXPECTED" level="MAJOR" enabled="true" />
<coding_rule class="DMI_UNSUPPORTED_METHOD" level="MAJOR" enabled="true" />
<coding_rule class="DMI_USELESS_SUBSTRING" level="CRITICAL" enabled="true" />
<coding_rule class="DMI_USING_REMOVEALL_TO_CLEAR_COLLECTION" level="CRITICAL" enabled="true" />
<coding_rule class="DMI_VACUOUS_CALL_TO_EASYMOCK_METHOD" level="MINOR" enabled="true" />
<coding_rule class="DMI_VACUOUS_SELF_COLLECTION_CALL" level="CRITICAL" enabled="true" />
<coding_rule class="DM_BOOLEAN_CTOR" level="MAJOR" enabled="true" />
<coding_rule class="DM_BOXED_PRIMITIVE_FOR_COMPARE" level="MAJOR" enabled="false" />
<coding_rule class="DM_BOXED_PRIMITIVE_FOR_PARSING" level="MAJOR" enabled="false" />
<coding_rule class="DM_BOXED_PRIMITIVE_TOSTRING" level="MAJOR" enabled="true" />
<coding_rule class="DM_CONVERT_CASE" level="INFO" enabled="true" />
<coding_rule class="DM_DEFAULT_ENCODING" level="CRITICAL" enabled="false" />
<coding_rule class="DM_EXIT" level="MAJOR" enabled="true" />
<coding_rule class="DM_FP_NUMBER_CTOR" level="MAJOR" enabled="true" />
<coding_rule class="DM_GC" level="MAJOR" enabled="true" />
<coding_rule class="DM_INVALID_MIN_MAX" level="MAJOR" enabled="false" />
<coding_rule class="DM_MONITOR_WAIT_ON_CONDITION" level="MAJOR" enabled="true" />
<coding_rule class="DM_NEW_FOR_GETCLASS" level="MAJOR" enabled="true" />
<coding_rule class="DM_NEXTINT_VIA_NEXTDOUBLE" level="MAJOR" enabled="true" />
<coding_rule class="DM_NUMBER_CTOR" level="CRITICAL" enabled="true" />
<coding_rule class="DM_RUN_FINALIZERS_ON_EXIT" level="MAJOR" enabled="true" />
<coding_rule class="DM_STRING_CTOR" level="MAJOR" enabled="true" />
<coding_rule class="DM_STRING_TOSTRING" level="INFO" enabled="true" />
<coding_rule class="DM_STRING_VOID_CTOR" level="MAJOR" enabled="true" />
<coding_rule class="DM_USELESS_THREAD" level="MAJOR" enabled="true" />
<coding_rule class="DP_CREATE_CLASSLOADER_INSIDE_DO_PRIVILEGED" level="MAJOR" enabled="true" />
<coding_rule class="DP_DO_INSIDE_DO_PRIVILEGED" level="MAJOR" enabled="true" />
<coding_rule class="EC_ARRAY_AND_NONARRAY" level="CRITICAL" enabled="true" />
<coding_rule class="EC_BAD_ARRAY_COMPARE" level="CRITICAL" enabled="true" />
<coding_rule class="EC_INCOMPATIBLE_ARRAY_COMPARE" level="MAJOR" enabled="false" />
<coding_rule class="EC_NULL_ARG" level="CRITICAL" enabled="true" />
<coding_rule class="EC_UNRELATED_CLASS_AND_INTERFACE" level="CRITICAL" enabled="true" />
<coding_rule class="EC_UNRELATED_INTERFACES" level="CRITICAL" enabled="true" />
<coding_rule class="EC_UNRELATED_TYPES" level="CRITICAL" enabled="true" />
<coding_rule class="EC_UNRELATED_TYPES_USING_POINTER_EQUALITY" level="CRITICAL" enabled="true" />
<coding_rule class="EI_EXPOSE_REP" level="MAJOR" enabled="true" />
<coding_rule class="EI_EXPOSE_REP2" level="MAJOR" enabled="true" />
<coding_rule class="EI_EXPOSE_STATIC_REP2" level="MAJOR" enabled="true" />
<coding_rule class="EQ_ABSTRACT_SELF" level="MAJOR" enabled="true" />
<coding_rule class="EQ_ALWAYS_FALSE" level="BLOCKER" enabled="true" />
<coding_rule class="EQ_ALWAYS_TRUE" level="BLOCKER" enabled="true" />
<coding_rule class="EQ_CHECK_FOR_OPERAND_NOT_COMPATIBLE_WITH_THIS" level="MAJOR" enabled="true" />
<coding_rule class="EQ_COMPARETO_USE_OBJECT_EQUALS" level="CRITICAL" enabled="true" />
<coding_rule class="EQ_COMPARING_CLASS_NAMES" level="MAJOR" enabled="true" />
<coding_rule class="EQ_DOESNT_OVERRIDE_EQUALS" level="MAJOR" enabled="false" />
<coding_rule class="EQ_DONT_DEFINE_EQUALS_FOR_ENUM" level="MAJOR" enabled="true" />
<coding_rule class="EQ_GETCLASS_AND_CLASS_CONSTANT" level="CRITICAL" enabled="true" />
<coding_rule class="EQ_OTHER_NO_OBJECT" level="MAJOR" enabled="true" />
<coding_rule class="EQ_OTHER_USE_OBJECT" level="MAJOR" enabled="true" />
<coding_rule class="EQ_OVERRIDING_EQUALS_NOT_SYMMETRIC" level="MAJOR" enabled="true" />
<coding_rule class="EQ_SELF_NO_OBJECT" level="MAJOR" enabled="true" />
<coding_rule class="EQ_SELF_USE_OBJECT" level="MAJOR" enabled="true" />
<coding_rule class="EQ_UNUSUAL" level="MINOR" enabled="true" />
<coding_rule class="ES_COMPARING_PARAMETER_STRING_WITH_EQ" level="MAJOR" enabled="true" />
<coding_rule class="ES_COMPARING_STRINGS_WITH_EQ" level="MAJOR" enabled="true" />
<coding_rule class="ESync_EMPTY_SYNC" level="MAJOR" enabled="true" />
<coding_rule class="FB_MISSING_EXPECTED_WARNING" level="CRITICAL" enabled="false" />
<coding_rule class="FB_UNEXPECTED_WARNING" level="CRITICAL" enabled="false" />
<coding_rule class="FE_FLOATING_POINT_EQUALITY" level="CRITICAL" enabled="true" />
<coding_rule class="FE_TEST_IF_EQUAL_TO_NOT_A_NUMBER" level="CRITICAL" enabled="true" />
<coding_rule class="FI_EMPTY" level="MAJOR" enabled="true" />
<coding_rule class="FI_EXPLICIT_INVOCATION" level="MAJOR" enabled="true" />
<coding_rule class="FI_FINALIZER_NULLS_FIELDS" level="MAJOR" enabled="true" />
<coding_rule class="FI_FINALIZER_ONLY_NULLS_FIELDS" level="MAJOR" enabled="true" />
<coding_rule class="FI_MISSING_SUPER_CALL" level="MAJOR" enabled="true" />
<coding_rule class="FI_NULLIFY_SUPER" level="CRITICAL" enabled="true" />
<coding_rule class="FI_PUBLIC_SHOULD_BE_PROTECTED" level="MAJOR" enabled="true" />
<coding_rule class="FI_USELESS" level="MINOR" enabled="true" />
<coding_rule class="FL_MATH_USING_FLOAT_PRECISION" level="CRITICAL" enabled="true" />
<coding_rule class="GC_UNCHECKED_TYPE_IN_GENERIC_CALL" level="CRITICAL" enabled="true" />
<coding_rule class="GC_UNRELATED_TYPES" level="CRITICAL" enabled="true" />
<coding_rule class="HE_EQUALS_NO_HASHCODE" level="MAJOR" enabled="true" />
<coding_rule class="HE_EQUALS_USE_HASHCODE" level="CRITICAL" enabled="true" />
<coding_rule class="HE_HASHCODE_NO_EQUALS" level="CRITICAL" enabled="true" />
<coding_rule class="HE_HASHCODE_USE_OBJECT_EQUALS" level="CRITICAL" enabled="true" />
<coding_rule class="HE_INHERITS_EQUALS_USE_HASHCODE" level="CRITICAL" enabled="true" />
<coding_rule class="HE_SIGNATURE_DECLARES_HASHING_OF_UNHASHABLE_CLASS" level="CRITICAL" enabled="true" />
<coding_rule class="HE_USE_OF_UNHASHABLE_CLASS" level="CRITICAL" enabled="true" />
<coding_rule class="HRS_REQUEST_PARAMETER_TO_COOKIE" level="MAJOR" enabled="true" />
<coding_rule class="HRS_REQUEST_PARAMETER_TO_HTTP_HEADER" level="MAJOR" enabled="true" />
<coding_rule class="HSC_HUGE_SHARED_STRING_CONSTANT" level="CRITICAL" enabled="true" />
<coding_rule class="IA_AMBIGUOUS_INVOCATION_OF_INHERITED_OR_OUTER_METHOD" level="MAJOR" enabled="true" />
<coding_rule class="ICAST_BAD_SHIFT_AMOUNT" level="CRITICAL" enabled="true" />
<coding_rule class="ICAST_IDIV_CAST_TO_DOUBLE" level="CRITICAL" enabled="true" />
<coding_rule class="ICAST_INTEGER_MULTIPLY_CAST_TO_LONG" level="CRITICAL" enabled="true" />
<coding_rule class="ICAST_INT_2_LONG_AS_INSTANT" level="CRITICAL" enabled="false" />
<coding_rule class="ICAST_INT_CAST_TO_DOUBLE_PASSED_TO_CEIL" level="CRITICAL" enabled="true" />
<coding_rule class="ICAST_INT_CAST_TO_FLOAT_PASSED_TO_ROUND" level="CRITICAL" enabled="true" />
<coding_rule class="ICAST_QUESTIONABLE_UNSIGNED_RIGHT_SHIFT" level="CRITICAL" enabled="true" />
<coding_rule class="IC_INIT_CIRCULARITY" level="CRITICAL" enabled="true" />
<coding_rule class="IC_SUPERCLASS_USES_SUBCLASS_DURING_INITIALIZATION" level="MAJOR" enabled="true" />
<coding_rule class="IIL_ELEMENTS_GET_LENGTH_IN_LOOP" level="MAJOR" enabled="false" />
<coding_rule class="IIL_PATTERN_COMPILE_IN_LOOP" level="MAJOR" enabled="false" />
<coding_rule class="IIL_PATTERN_COMPILE_IN_LOOP_INDIRECT" level="MAJOR" enabled="false" />
<coding_rule class="IIL_PREPARE_STATEMENT_IN_LOOP" level="MAJOR" enabled="false" />
<coding_rule class="IIO_INEFFICIENT_INDEX_OF" level="MAJOR" enabled="false" />
<coding_rule class="IIO_INEFFICIENT_LAST_INDEX_OF" level="MAJOR" enabled="false" />
<coding_rule class="IJU_ASSERT_METHOD_INVOKED_FROM_RUN_METHOD" level="CRITICAL" enabled="true" />
<coding_rule class="IJU_BAD_SUITE_METHOD" level="CRITICAL" enabled="true" />
<coding_rule class="IJU_NO_TESTS" level="CRITICAL" enabled="true" />
<coding_rule class="IJU_SETUP_NO_SUPER" level="CRITICAL" enabled="true" />
<coding_rule class="IJU_SUITE_NOT_STATIC" level="CRITICAL" enabled="true" />
<coding_rule class="IJU_TEARDOWN_NO_SUPER" level="CRITICAL" enabled="true" />
<coding_rule class="IL_CONTAINER_ADDED_TO_ITSELF" level="CRITICAL" enabled="true" />
<coding_rule class="IL_INFINITE_LOOP" level="CRITICAL" enabled="true" />
<coding_rule class="IL_INFINITE_RECURSIVE_LOOP" level="CRITICAL" enabled="true" />
<coding_rule class="IMA_INEFFICIENT_MEMBER_ACCESS" level="MAJOR" enabled="false" />
<coding_rule class="IMSE_DONT_CATCH_IMSE" level="MAJOR" enabled="true" />
<coding_rule class="IM_AVERAGE_COMPUTATION_COULD_OVERFLOW" level="CRITICAL" enabled="true" />
<coding_rule class="IM_BAD_CHECK_FOR_ODD" level="CRITICAL" enabled="true" />
<coding_rule class="IM_MULTIPLYING_RESULT_OF_IREM" level="CRITICAL" enabled="true" />
<coding_rule class="INT_BAD_COMPARISON_WITH_INT_VALUE" level="CRITICAL" enabled="false" />
<coding_rule class="INT_BAD_COMPARISON_WITH_NONNEGATIVE_VALUE" level="CRITICAL" enabled="true" />
<coding_rule class="INT_BAD_COMPARISON_WITH_SIGNED_BYTE" level="CRITICAL" enabled="true" />
<coding_rule class="INT_BAD_REM_BY_1" level="CRITICAL" enabled="true" />
<coding_rule class="INT_VACUOUS_BIT_OPERATION" level="CRITICAL" enabled="true" />
<coding_rule class="INT_VACUOUS_COMPARISON" level="CRITICAL" enabled="true" />
<coding_rule class="IO_APPENDING_TO_OBJECT_OUTPUT_STREAM" level="CRITICAL" enabled="true" />
<coding_rule class="IP_PARAMETER_IS_DEAD_BUT_OVERWRITTEN" level="CRITICAL" enabled="true" />
<coding_rule class="IS2_INCONSISTENT_SYNC" level="CRITICAL" enabled="true" />
<coding_rule class="ISC_INSTANTIATE_STATIC_CLASS" level="MAJOR" enabled="true" />
<coding_rule class="IS_FIELD_NOT_GUARDED" level="CRITICAL" enabled="true" />
<coding_rule class="ITA_INEFFICIENT_TO_ARRAY" level="CRITICAL" enabled="true" />
<coding_rule class="IT_NO_SUCH_ELEMENT" level="MINOR" enabled="true" />
<coding_rule class="J2EE_STORE_OF_NON_SERIALIZABLE_OBJECT_INTO_SESSION" level="CRITICAL" enabled="true" />
<coding_rule class="JCIP_FIELD_ISNT_FINAL_IN_IMMUTABLE_CLASS" level="MINOR" enabled="true" />
<coding_rule class="JLM_JSR166_LOCK_MONITORENTER" level="CRITICAL" enabled="true" />
<coding_rule class="JLM_JSR166_UTILCONCURRENT_MONITORENTER" level="CRITICAL" enabled="false" />
<coding_rule class="JML_JSR166_CALLING_WAIT_RATHER_THAN_AWAIT" level="CRITICAL" enabled="false" />
<coding_rule class="LG_LOST_LOGGER_DUE_TO_WEAK_REFERENCE" level="MAJOR" enabled="false" />
<coding_rule class="LI_LAZY_INIT_STATIC" level="CRITICAL" enabled="true" />
<coding_rule class="LI_LAZY_INIT_UPDATE_STATIC" level="CRITICAL" enabled="true" />
<coding_rule class="ME_ENUM_FIELD_SETTER" level="MAJOR" enabled="false" />
<coding_rule class="ME_MUTABLE_ENUM_FIELD" level="MAJOR" enabled="false" />
<coding_rule class="MF_CLASS_MASKS_FIELD" level="MAJOR" enabled="true" />
<coding_rule class="MF_METHOD_MASKS_FIELD" level="MAJOR" enabled="true" />
<coding_rule class="ML_SYNC_ON_FIELD_TO_GUARD_CHANGING_THAT_FIELD" level="MAJOR" enabled="true" />
<coding_rule class="ML_SYNC_ON_UPDATED_FIELD" level="MAJOR" enabled="true" />
<coding_rule class="MSF_MUTABLE_SERVLET_FIELD" level="MAJOR" enabled="true" />
<coding_rule class="MS_CANNOT_BE_FINAL" level="MAJOR" enabled="true" />
<coding_rule class="MS_EXPOSE_REP" level="CRITICAL" enabled="true" />
<coding_rule class="MS_FINAL_PKGPROTECT" level="MAJOR" enabled="true" />
<coding_rule class="MS_MUTABLE_ARRAY" level="MAJOR" enabled="true" />
<coding_rule class="MS_MUTABLE_COLLECTION" level="MAJOR" enabled="false" />
<coding_rule class="MS_MUTABLE_COLLECTION_PKGPROTECT" level="MAJOR" enabled="false" />
<coding_rule class="MS_MUTABLE_HASHTABLE" level="MAJOR" enabled="true" />
<coding_rule class="MS_OOI_PKGPROTECT" level="MAJOR" enabled="true" />
<coding_rule class="MS_PKGPROTECT" level="MAJOR" enabled="true" />
<coding_rule class="MS_SHOULD_BE_FINAL" level="MAJOR" enabled="true" />
<coding_rule class="MS_SHOULD_BE_REFACTORED_TO_BE_FINAL" level="CRITICAL" enabled="false" />
<coding_rule class="MTIA_SUSPECT_SERVLET_INSTANCE_FIELD" level="CRITICAL" enabled="true" />
<coding_rule class="MTIA_SUSPECT_STRUTS_INSTANCE_FIELD" level="CRITICAL" enabled="true" />
<coding_rule class="MWN_MISMATCHED_NOTIFY" level="CRITICAL" enabled="true" />
<coding_rule class="MWN_MISMATCHED_WAIT" level="CRITICAL" enabled="true" />
<coding_rule class="NM_BAD_EQUAL" level="MAJOR" enabled="false" />
<coding_rule class="NM_CLASS_NAMING_CONVENTION" level="MAJOR" enabled="false" />
<coding_rule class="NM_CLASS_NOT_EXCEPTION" level="MAJOR" enabled="true" />
<coding_rule class="NM_CONFUSING" level="MAJOR" enabled="true" />
<coding_rule class="NM_FIELD_NAMING_CONVENTION" level="MAJOR" enabled="false" />
<coding_rule class="NM_FUTURE_KEYWORD_USED_AS_IDENTIFIER" level="MAJOR" enabled="true" />
<coding_rule class="NM_FUTURE_KEYWORD_USED_AS_MEMBER_IDENTIFIER" level="MAJOR" enabled="true" />
<coding_rule class="NM_LCASE_HASHCODE" level="MAJOR" enabled="false" />
<coding_rule class="NM_LCASE_TOSTRING" level="MAJOR" enabled="false" />
<coding_rule class="NM_METHOD_CONSTRUCTOR_CONFUSION" level="MAJOR" enabled="true" />
<coding_rule class="NM_METHOD_NAMING_CONVENTION" level="MAJOR" enabled="false" />
<coding_rule class="NM_SAME_SIMPLE_NAME_AS_INTERFACE" level="MAJOR" enabled="true" />
<coding_rule class="NM_SAME_SIMPLE_NAME_AS_SUPERCLASS" level="MAJOR" enabled="true" />
<coding_rule class="NM_VERY_CONFUSING" level="MAJOR" enabled="true" />
<coding_rule class="NM_VERY_CONFUSING_INTENTIONAL" level="MAJOR" enabled="true" />
<coding_rule class="NM_WRONG_PACKAGE" level="MAJOR" enabled="true" />
<coding_rule class="NM_WRONG_PACKAGE_INTENTIONAL" level="MAJOR" enabled="true" />
<coding_rule class="NN_NAKED_NOTIFY" level="CRITICAL" enabled="true" />
<coding_rule class="NOISE_FIELD_REFERENCE" level="MAJOR" enabled="false" />
<coding_rule class="NOISE_METHOD_CALL" level="MAJOR" enabled="false" />
<coding_rule class="NOISE_NULL_DEREFERENCE" level="MAJOR" enabled="false" />
<coding_rule class="NOISE_OPERATION" level="MAJOR" enabled="false" />
<coding_rule class="NO_NOTIFY_NOT_NOTIFYALL" level="CRITICAL" enabled="true" />
<coding_rule class="NP_ALWAYS_NULL" level="CRITICAL" enabled="true" />
<coding_rule class="NP_ALWAYS_NULL_EXCEPTION" level="CRITICAL" enabled="true" />
<coding_rule class="NP_ARGUMENT_MIGHT_BE_NULL" level="MAJOR" enabled="true" />
<coding_rule class="NP_BOOLEAN_RETURN_NULL" level="MAJOR" enabled="true" />
<coding_rule class="NP_CLONE_COULD_RETURN_NULL" level="CRITICAL" enabled="true" />
<coding_rule class="NP_CLOSING_NULL" level="MAJOR" enabled="false" />
<coding_rule class="NP_DEREFERENCE_OF_READLINE_VALUE" level="CRITICAL" enabled="true" />
<coding_rule class="NP_EQUALS_SHOULD_HANDLE_NULL_ARGUMENT" level="CRITICAL" enabled="true" />
<coding_rule class="NP_GUARANTEED_DEREF" level="BLOCKER" enabled="true" />
<coding_rule class="NP_GUARANTEED_DEREF_ON_EXCEPTION_PATH" level="CRITICAL" enabled="true" />
<coding_rule class="NP_IMMEDIATE_DEREFERENCE_OF_READLINE" level="CRITICAL" enabled="true" />
<coding_rule class="NP_LOAD_OF_KNOWN_NULL_VALUE" level="CRITICAL" enabled="true" />
<coding_rule class="NP_METHOD_PARAMETER_TIGHTENS_ANNOTATION" level="MAJOR" enabled="false" />
<coding_rule class="NP_METHOD_RETURN_RELAXING_ANNOTATION" level="MAJOR" enabled="false" />
<coding_rule class="NP_NONNULL_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR" level="CRITICAL" enabled="false" />
<coding_rule class="NP_NONNULL_PARAM_VIOLATION" level="CRITICAL" enabled="true" />
<coding_rule class="NP_NONNULL_RETURN_VIOLATION" level="CRITICAL" enabled="true" />
<coding_rule class="NP_NULL_INSTANCEOF" level="BLOCKER" enabled="true" />
<coding_rule class="NP_NULL_ON_SOME_PATH" level="CRITICAL" enabled="true" />
<coding_rule class="NP_NULL_ON_SOME_PATH_EXCEPTION" level="CRITICAL" enabled="true" />
<coding_rule class="NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE" level="CRITICAL" enabled="true" />
<coding_rule class="NP_NULL_ON_SOME_PATH_MIGHT_BE_INFEASIBLE" level="CRITICAL" enabled="true" />
<coding_rule class="NP_NULL_PARAM_DEREF" level="CRITICAL" enabled="true" />
<coding_rule class="NP_NULL_PARAM_DEREF_ALL_TARGETS_DANGEROUS" level="CRITICAL" enabled="true" />
<coding_rule class="NP_NULL_PARAM_DEREF_NONVIRTUAL" level="CRITICAL" enabled="true" />
<coding_rule class="NP_OPTIONAL_RETURN_NULL" level="MAJOR" enabled="false" />
<coding_rule class="NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE" level="CRITICAL" enabled="true" />
<coding_rule class="NP_STORE_INTO_NONNULL_FIELD" level="CRITICAL" enabled="true" />
<coding_rule class="NP_SYNC_AND_NULL_CHECK_FIELD" level="MAJOR" enabled="true" />
<coding_rule class="NP_TOSTRING_COULD_RETURN_NULL" level="CRITICAL" enabled="true" />
<coding_rule class="NP_UNWRITTEN_FIELD" level="MAJOR" enabled="false" />
<coding_rule class="NP_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD" level="CRITICAL" enabled="false" />
<coding_rule class="NS_DANGEROUS_NON_SHORT_CIRCUIT" level="CRITICAL" enabled="true" />
<coding_rule class="NS_NON_SHORT_CIRCUIT" level="MAJOR" enabled="true" />
<coding_rule class="OBL_UNSATISFIED_OBLIGATION" level="CRITICAL" enabled="false" />
<coding_rule class="OBL_UNSATISFIED_OBLIGATION_EXCEPTION_EDGE" level="CRITICAL" enabled="false" />
<coding_rule class="ODR_OPEN_DATABASE_RESOURCE" level="CRITICAL" enabled="true" />
<coding_rule class="ODR_OPEN_DATABASE_RESOURCE_EXCEPTION_PATH" level="CRITICAL" enabled="true" />
<coding_rule class="OS_OPEN_STREAM" level="CRITICAL" enabled="true" />
<coding_rule class="OS_OPEN_STREAM_EXCEPTION_PATH" level="CRITICAL" enabled="true" />
<coding_rule class="PS_PUBLIC_SEMAPHORES" level="CRITICAL" enabled="true" />
<coding_rule class="PT_ABSOLUTE_PATH_TRAVERSAL" level="CRITICAL" enabled="false" />
<coding_rule class="PT_RELATIVE_PATH_TRAVERSAL" level="CRITICAL" enabled="false" />
<coding_rule class="PZLA_PREFER_ZERO_LENGTH_ARRAYS" level="MAJOR" enabled="true" />
<coding_rule class="PZ_DONT_REUSE_ENTRY_OBJECTS_IN_ITERATORS" level="CRITICAL" enabled="false" />
<coding_rule class="QBA_QUESTIONABLE_BOOLEAN_ASSIGNMENT" level="CRITICAL" enabled="true" />
<coding_rule class="QF_QUESTIONABLE_FOR_LOOP" level="CRITICAL" enabled="true" />
<coding_rule class="RANGE_ARRAY_INDEX" level="MAJOR" enabled="false" />
<coding_rule class="RANGE_ARRAY_LENGTH" level="MAJOR" enabled="false" />
<coding_rule class="RANGE_ARRAY_OFFSET" level="MAJOR" enabled="false" />
<coding_rule class="RANGE_STRING_INDEX" level="MAJOR" enabled="false" />
<coding_rule class="RCN_REDUNDANT_COMPARISON_OF_NULL_AND_NONNULL_VALUE" level="CRITICAL" enabled="true" />
<coding_rule class="RCN_REDUNDANT_COMPARISON_TWO_NULL_VALUES" level="CRITICAL" enabled="true" />
<coding_rule class="RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE" level="CRITICAL" enabled="true" />
<coding_rule class="RCN_REDUNDANT_NULLCHECK_OF_NULL_VALUE" level="CRITICAL" enabled="true" />
<coding_rule class="RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE" level="CRITICAL" enabled="true" />
<coding_rule class="RC_REF_COMPARISON" level="CRITICAL" enabled="true" />
<coding_rule class="RC_REF_COMPARISON_BAD_PRACTICE" level="MAJOR" enabled="false" />
<coding_rule class="RC_REF_COMPARISON_BAD_PRACTICE_BOOLEAN" level="MAJOR" enabled="false" />
<coding_rule class="REC_CATCH_EXCEPTION" level="MAJOR" enabled="true" />
<coding_rule class="RE_BAD_SYNTAX_FOR_REGULAR_EXPRESSION" level="CRITICAL" enabled="true" />
<coding_rule class="RE_CANT_USE_FILE_SEPARATOR_AS_REGULAR_EXPRESSION" level="CRITICAL" enabled="true" />
<coding_rule class="RE_POSSIBLE_UNINTENDED_PATTERN" level="CRITICAL" enabled="true" />
<coding_rule class="RI_REDUNDANT_INTERFACES" level="MAJOR" enabled="true" />
<coding_rule class="RR_NOT_CHECKED" level="MAJOR" enabled="true" />
<coding_rule class="RS_READOBJECT_SYNC" level="CRITICAL" enabled="true" />
<coding_rule class="RU_INVOKE_RUN" level="MAJOR" enabled="true" />
<coding_rule class="RV_01_TO_INT" level="MAJOR" enabled="true" />
<coding_rule class="RV_ABSOLUTE_VALUE_OF_HASHCODE" level="CRITICAL" enabled="true" />
<coding_rule class="RV_ABSOLUTE_VALUE_OF_RANDOM_INT" level="CRITICAL" enabled="true" />
<coding_rule class="RV_CHECK_COMPARETO_FOR_SPECIFIC_RETURN_VALUE" level="CRITICAL" enabled="false" />
<coding_rule class="RV_CHECK_FOR_POSITIVE_INDEXOF" level="MINOR" enabled="true" />
<coding_rule class="RV_DONT_JUST_NULL_CHECK_READLINE" level="MAJOR" enabled="true" />
<coding_rule class="RV_EXCEPTION_NOT_THROWN" level="CRITICAL" enabled="true" />
<coding_rule class="RV_NEGATING_RESULT_OF_COMPARETO" level="CRITICAL" enabled="false" />
<coding_rule class="RV_REM_OF_HASHCODE" level="CRITICAL" enabled="true" />
<coding_rule class="RV_REM_OF_RANDOM_INT" level="CRITICAL" enabled="true" />
<coding_rule class="RV_RETURN_VALUE_IGNORED" level="MINOR" enabled="true" />
<coding_rule class="RV_RETURN_VALUE_IGNORED_BAD_PRACTICE" level="MAJOR" enabled="true" />
<coding_rule class="RV_RETURN_VALUE_IGNORED_INFERRED" level="CRITICAL" enabled="false" />
<coding_rule class="RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT" level="MAJOR" enabled="false" />
<coding_rule class="RV_RETURN_VALUE_OF_PUTIFABSENT_IGNORED" level="MAJOR" enabled="false" />
<coding_rule class="RpC_REPEATED_CONDITIONAL_TEST" level="MAJOR" enabled="true" />
<coding_rule class="SA_FIELD_DOUBLE_ASSIGNMENT" level="CRITICAL" enabled="true" />
<coding_rule class="SA_FIELD_SELF_ASSIGNMENT" level="CRITICAL" enabled="true" />
<coding_rule class="SA_FIELD_SELF_COMPARISON" level="CRITICAL" enabled="true" />
<coding_rule class="SA_FIELD_SELF_COMPUTATION" level="CRITICAL" enabled="true" />
<coding_rule class="SA_LOCAL_DOUBLE_ASSIGNMENT" level="CRITICAL" enabled="true" />
<coding_rule class="SA_LOCAL_SELF_ASSIGNMENT" level="CRITICAL" enabled="true" />
<coding_rule class="SA_LOCAL_SELF_ASSIGNMENT_INSTEAD_OF_FIELD" level="CRITICAL" enabled="false" />
<coding_rule class="SA_LOCAL_SELF_COMPARISON" level="CRITICAL" enabled="true" />
<coding_rule class="SA_LOCAL_SELF_COMPUTATION" level="CRITICAL" enabled="true" />
<coding_rule class="SBSC_USE_STRINGBUFFER_CONCATENATION" level="CRITICAL" enabled="true" />
<coding_rule class="SC_START_IN_CTOR" level="CRITICAL" enabled="true" />
<coding_rule class="SE_BAD_FIELD" level="MINOR" enabled="false" />
<coding_rule class="SE_BAD_FIELD_INNER_CLASS" level="MINOR" enabled="true" />
<coding_rule class="SE_BAD_FIELD_STORE" level="CRITICAL" enabled="true" />
<coding_rule class="SE_COMPARATOR_SHOULD_BE_SERIALIZABLE" level="MAJOR" enabled="true" />
<coding_rule class="SE_INNER_CLASS" level="MAJOR" enabled="true" />
<coding_rule class="SE_METHOD_MUST_BE_PRIVATE" level="MAJOR" enabled="true" />
<coding_rule class="SE_NONFINAL_SERIALVERSIONID" level="CRITICAL" enabled="true" />
<coding_rule class="SE_NONLONG_SERIALVERSIONID" level="MAJOR" enabled="true" />
<coding_rule class="SE_NONSTATIC_SERIALVERSIONID" level="MAJOR" enabled="true" />
<coding_rule class="SE_NO_SERIALVERSIONID" level="MAJOR" enabled="true" />
<coding_rule class="SE_NO_SUITABLE_CONSTRUCTOR" level="MAJOR" enabled="true" />
<coding_rule class="SE_NO_SUITABLE_CONSTRUCTOR_FOR_EXTERNALIZATION" level="MAJOR" enabled="true" />
<coding_rule class="SE_PRIVATE_READ_RESOLVE_NOT_INHERITED" level="MAJOR" enabled="true" />
<coding_rule class="SE_READ_RESOLVE_IS_STATIC" level="MAJOR" enabled="true" />
<coding_rule class="SE_READ_RESOLVE_MUST_RETURN_OBJECT" level="MAJOR" enabled="true" />
<coding_rule class="SE_TRANSIENT_FIELD_NOT_RESTORED" level="MAJOR" enabled="true" />
<coding_rule class="SE_TRANSIENT_FIELD_OF_NONSERIALIZABLE_CLASS" level="MAJOR" enabled="true" />
<coding_rule class="SF_DEAD_STORE_DUE_TO_SWITCH_FALLTHROUGH" level="MAJOR" enabled="false" />
<coding_rule class="SF_DEAD_STORE_DUE_TO_SWITCH_FALLTHROUGH_TO_THROW" level="MAJOR" enabled="false" />
<coding_rule class="SF_SWITCH_FALLTHROUGH" level="MAJOR" enabled="false" />
<coding_rule class="SF_SWITCH_NO_DEFAULT" level="MAJOR" enabled="false" />
<coding_rule class="SIC_INNER_SHOULD_BE_STATIC" level="MAJOR" enabled="true" />
<coding_rule class="SIC_INNER_SHOULD_BE_STATIC_ANON" level="MAJOR" enabled="true" />
<coding_rule class="SIC_INNER_SHOULD_BE_STATIC_NEEDS_THIS" level="MAJOR" enabled="true" />
<coding_rule class="SIC_THREADLOCAL_DEADLY_EMBRACE" level="MAJOR" enabled="false" />
<coding_rule class="SIO_SUPERFLUOUS_INSTANCEOF" level="CRITICAL" enabled="true" />
<coding_rule class="SI_INSTANCE_BEFORE_FINALS_ASSIGNED" level="CRITICAL" enabled="true" />
<coding_rule class="SP_SPIN_ON_FIELD" level="MAJOR" enabled="true" />
<coding_rule class="SQL_BAD_PREPARED_STATEMENT_ACCESS" level="CRITICAL" enabled="true" />
<coding_rule class="SQL_BAD_RESULTSET_ACCESS" level="CRITICAL" enabled="true" />
<coding_rule class="SQL_NONCONSTANT_STRING_PASSED_TO_EXECUTE" level="CRITICAL" enabled="true" />
<coding_rule class="SQL_PREPARED_STATEMENT_GENERATED_FROM_NONCONSTANT_STRING" level="CRITICAL" enabled="true" />
<coding_rule class="SR_NOT_CHECKED" level="MAJOR" enabled="true" />
<coding_rule class="SS_SHOULD_BE_STATIC" level="MAJOR" enabled="true" />
<coding_rule class="STCAL_INVOKE_ON_STATIC_CALENDAR_INSTANCE" level="CRITICAL" enabled="true" />
<coding_rule class="STCAL_INVOKE_ON_STATIC_DATE_FORMAT_INSTANCE" level="CRITICAL" enabled="true" />
<coding_rule class="STCAL_STATIC_CALENDAR_INSTANCE" level="CRITICAL" enabled="true" />
<coding_rule class="STCAL_STATIC_SIMPLE_DATE_FORMAT_INSTANCE" level="CRITICAL" enabled="true" />
<coding_rule class="STI_INTERRUPTED_ON_CURRENTTHREAD" level="CRITICAL" enabled="true" />
<coding_rule class="STI_INTERRUPTED_ON_UNKNOWNTHREAD" level="CRITICAL" enabled="true" />
<coding_rule class="ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD" level="CRITICAL" enabled="true" />
<coding_rule class="SWL_SLEEP_WITH_LOCK_HELD" level="CRITICAL" enabled="true" />
<coding_rule class="SW_SWING_METHODS_INVOKED_IN_SWING_THREAD" level="MAJOR" enabled="true" />
<coding_rule class="TLW_TWO_LOCK_WAIT" level="MAJOR" enabled="true" />
<coding_rule class="TQ_ALWAYS_VALUE_USED_WHERE_NEVER_REQUIRED" level="CRITICAL" enabled="true" />
<coding_rule class="TQ_COMPARING_VALUES_WITH_INCOMPATIBLE_TYPE_QUALIFIERS" level="CRITICAL" enabled="false" />
<coding_rule class="TQ_EXPLICIT_UNKNOWN_SOURCE_VALUE_REACHES_ALWAYS_SINK" level="CRITICAL" enabled="true" />
<coding_rule class="TQ_EXPLICIT_UNKNOWN_SOURCE_VALUE_REACHES_NEVER_SINK" level="CRITICAL" enabled="true" />
<coding_rule class="TQ_MAYBE_SOURCE_VALUE_REACHES_ALWAYS_SINK" level="CRITICAL" enabled="true" />
<coding_rule class="TQ_MAYBE_SOURCE_VALUE_REACHES_NEVER_SINK" level="CRITICAL" enabled="true" />
<coding_rule class="TQ_NEVER_VALUE_USED_WHERE_ALWAYS_REQUIRED" level="CRITICAL" enabled="true" />
<coding_rule class="TQ_UNKNOWN_VALUE_USED_WHERE_ALWAYS_STRICTLY_REQUIRED" level="CRITICAL" enabled="false" />
<coding_rule class="UCF_USELESS_CONTROL_FLOW" level="CRITICAL" enabled="true" />
<coding_rule class="UCF_USELESS_CONTROL_FLOW_NEXT_LINE" level="CRITICAL" enabled="true" />
<coding_rule class="UC_USELESS_CONDITION" level="MAJOR" enabled="false" />
<coding_rule class="UC_USELESS_CONDITION_TYPE" level="MAJOR" enabled="false" />
<coding_rule class="UC_USELESS_OBJECT" level="MAJOR" enabled="false" />
<coding_rule class="UC_USELESS_OBJECT_STACK" level="MAJOR" enabled="false" />
<coding_rule class="UC_USELESS_VOID_METHOD" level="MAJOR" enabled="false" />
<coding_rule class="UG_SYNC_SET_UNSYNC_GET" level="MAJOR" enabled="true" />
<coding_rule class="UI_INHERITANCE_UNSAFE_GETRESOURCE" level="MAJOR" enabled="true" />
<coding_rule class="UL_UNRELEASED_LOCK" level="CRITICAL" enabled="true" />
<coding_rule class="UL_UNRELEASED_LOCK_EXCEPTION_PATH" level="CRITICAL" enabled="true" />
<coding_rule class="UMAC_UNCALLABLE_METHOD_OF_ANONYMOUS_CLASS" level="CRITICAL" enabled="true" />
<coding_rule class="UM_UNNECESSARY_MATH" level="CRITICAL" enabled="true" />
<coding_rule class="UPM_UNCALLED_PRIVATE_METHOD" level="CRITICAL" enabled="true" />
<coding_rule class="URF_UNREAD_FIELD" level="MAJOR" enabled="true" />
<coding_rule class="URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD" level="CRITICAL" enabled="false" />
<coding_rule class="UR_UNINIT_READ" level="MAJOR" enabled="true" />
<coding_rule class="UR_UNINIT_READ_CALLED_FROM_SUPER_CONSTRUCTOR" level="MAJOR" enabled="false" />
<coding_rule class="USM_USELESS_ABSTRACT_METHOD" level="MAJOR" enabled="false" />
<coding_rule class="USM_USELESS_SUBCLASS_METHOD" level="MAJOR" enabled="false" />
<coding_rule class="UUF_UNUSED_FIELD" level="MAJOR" enabled="true" />
<coding_rule class="UUF_UNUSED_PUBLIC_OR_PROTECTED_FIELD" level="CRITICAL" enabled="false" />
<coding_rule class="UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR" level="MAJOR" enabled="false" />
<coding_rule class="UWF_NULL_FIELD" level="CRITICAL" enabled="true" />
<coding_rule class="UWF_UNWRITTEN_FIELD" level="MAJOR" enabled="false" />
<coding_rule class="UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD" level="CRITICAL" enabled="false" />
<coding_rule class="UW_UNCOND_WAIT" level="MAJOR" enabled="true" />
<coding_rule class="VA_FORMAT_STRING_BAD_ARGUMENT" level="CRITICAL" enabled="true" />
<coding_rule class="VA_FORMAT_STRING_BAD_CONVERSION" level="CRITICAL" enabled="true" />
<coding_rule class="VA_FORMAT_STRING_BAD_CONVERSION_FROM_ARRAY" level="MAJOR" enabled="true" />
<coding_rule class="VA_FORMAT_STRING_BAD_CONVERSION_TO_BOOLEAN" level="MAJOR" enabled="true" />
<coding_rule class="VA_FORMAT_STRING_EXPECTED_MESSAGE_FORMAT_SUPPLIED" level="MAJOR" enabled="false" />
<coding_rule class="VA_FORMAT_STRING_EXTRA_ARGUMENTS_PASSED" level="MAJOR" enabled="true" />
<coding_rule class="VA_FORMAT_STRING_ILLEGAL" level="CRITICAL" enabled="true" />
<coding_rule class="VA_FORMAT_STRING_MISSING_ARGUMENT" level="CRITICAL" enabled="true" />
<coding_rule class="VA_FORMAT_STRING_NO_PREVIOUS_ARGUMENT" level="CRITICAL" enabled="true" />
<coding_rule class="VA_FORMAT_STRING_USES_NEWLINE" level="CRITICAL" enabled="false" />
<coding_rule class="VA_PRIMITIVE_ARRAY_PASSED_TO_OBJECT_VARARG" level="CRITICAL" enabled="true" />
<coding_rule class="VO_VOLATILE_INCREMENT" level="CRITICAL" enabled="false" />
<coding_rule class="VO_VOLATILE_REFERENCE_TO_ARRAY" level="MAJOR" enabled="true" />
<coding_rule class="VR_UNRESOLVABLE_REFERENCE" level="MAJOR" enabled="false" />
<coding_rule class="WA_AWAIT_NOT_IN_LOOP" level="CRITICAL" enabled="true" />
<coding_rule class="WA_NOT_IN_LOOP" level="CRITICAL" enabled="true" />
<coding_rule class="WL_USING_GETCLASS_RATHER_THAN_CLASS_LITERAL" level="CRITICAL" enabled="true" />
<coding_rule class="WMI_WRONG_MAP_ITERATOR" level="CRITICAL" enabled="true" />
<coding_rule class="WS_WRITEOBJECT_SYNC" level="CRITICAL" enabled="true" />
<coding_rule class="XFB_XML_FACTORY_BYPASS" level="CRITICAL" enabled="true" />
<coding_rule class="XSS_REQUEST_PARAMETER_TO_JSP_WRITER" level="CRITICAL" enabled="true" />
<coding_rule class="XSS_REQUEST_PARAMETER_TO_SEND_ERROR" level="CRITICAL" enabled="true" />
<coding_rule class="XSS_REQUEST_PARAMETER_TO_SERVLET_WRITER" level="CRITICAL" enabled="true" />
</profile>
</profiles>
<list size="0" />
</component>
</project>

View File

@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
</set>
</option>
</component>
</project>

7
OCH/README.md Normal file
View File

@@ -0,0 +1,7 @@
# 网约车(Online Car Hailing)
## 小巴
## 出租车
## 无实现

View File

@@ -0,0 +1,62 @@
apply plugin: 'com.android.library'
apply plugin: 'com.alibaba.arouter'
android {
compileSdkVersion rootProject.ext.android.compileSdkVersion
// buildToolsVersion rootProject.ext.android.buildToolsVersion
defaultConfig {
minSdkVersion rootProject.ext.android.minSdkVersion
targetSdkVersion rootProject.ext.android.targetSdkVersion
versionCode Integer.valueOf(VERSION_CODE)
versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION")
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
javaCompileOptions {
annotationProcessorOptions {
arguments = [AROUTER_MODULE_NAME: project.getName()]
}
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation rootProject.ext.dependencies.androidxappcompat
implementation rootProject.ext.dependencies.arouter
annotationProcessor rootProject.ext.dependencies.aroutercompiler
implementation rootProject.ext.dependencies.androidxconstraintlayout
implementation rootProject.ext.dependencies.rxjava
implementation rootProject.ext.dependencies.rxandroid
implementation rootProject.ext.dependencies.androidxrecyclerview
if (Boolean.valueOf(RELEASE)) {
implementation rootProject.ext.dependencies.mogooch
implementation rootProject.ext.dependencies.mogoutils
implementation rootProject.ext.dependencies.mogocommons
implementation rootProject.ext.dependencies.modulecommon
} else {
implementation project(":OCH:mogo-och")
implementation project(":foudations:mogo-utils")
implementation project(":foudations:mogo-commons")
implementation project(":modules:mogo-module-common")
}
}
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()

View File

@@ -0,0 +1,3 @@
GROUP=com.mogo.och
POM_ARTIFACT_ID=och-bus
VERSION_CODE=1

View File

@@ -0,0 +1,15 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mogo.och.bus">
<application>
<!--这里是为了测试增加的广播-->
<receiver android:name=".receiver.TestOchBusBroadcastReceiver">
<intent-filter>
<action android:name="com.bus.test_control" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
</application>
</manifest>

View File

@@ -0,0 +1,94 @@
package com.mogo.och.bus;
import android.content.Context;
import androidx.fragment.app.FragmentActivity;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.och.IMogoOCH;
import com.mogo.och.OCHConstants;
import com.mogo.och.bus.bean.OchBusStation;
import com.mogo.och.bus.fragment.OchBusFragment;
import com.mogo.service.connection.IMogoOnMessageListener;
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
import com.mogo.service.statusmanager.StatusDescriptor;
import com.mogo.utils.UiThreadHandler;
import com.mogo.utils.logger.Logger;
import java.util.List;
/**
* 网约车小巴业务实现入口
*
* @author tongchenfei
*/
@Route(path = OCHConstants.PATH)
public class OchBusProvider implements IMogoOCH {
private static final String TAG = "OchBusProvider";
private OchBusFragment busFragment;
private int containerId;
private FragmentActivity activity;
@Override
public void init(FragmentActivity activity, int containerId) {
this.containerId = containerId;
this.activity = activity;
UiThreadHandler.postDelayed(this::stepIntoVrMode, 5_000L );
}
/**
* 进入鹰眼模式,设置手势缩放地图失效
*/
private void stepIntoVrMode(){
Logger.d( TAG, "进入vr模式" );
MogoApisHandler.getInstance()
.getApis()
.getMapServiceApi()
.getMapUIController()
.openVrMode(false);
}
@Override
public void init(Context context) {
MogoApisHandler.getInstance().getApis().getStatusManagerApi().registerStatusChangedListener("OchBus", StatusDescriptor.VR_MODE, statusChangedListener);
MogoApisHandler.getInstance().getApis().getStatusManagerApi().registerStatusChangedListener("OchBus", StatusDescriptor.TOP_VIEW, statusChangedListener);
}
private void showFragment() {
if (busFragment == null) {
Logger.d(TAG, "准备add fragment======");
busFragment = new OchBusFragment();
activity.getSupportFragmentManager().beginTransaction().add(containerId, busFragment).commit();
return;
}
Logger.d(TAG, "准备show fragment");
activity.getSupportFragmentManager().beginTransaction().show(busFragment).commit();
}
private void hideFragment() {
if (busFragment != null) {
Logger.d(TAG, "准备hide fragment");
activity.getSupportFragmentManager().beginTransaction().hide(busFragment).commit();
}
}
private final IMogoStatusChangedListener statusChangedListener = (descriptor, isTrue) -> {
if (descriptor == StatusDescriptor.VR_MODE) {
// 进入vr模式默认显示网约车小巴fragment
if (isTrue) {
showFragment();
} else {
hideFragment();
}
} else if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() && descriptor == StatusDescriptor.TOP_VIEW) {
// topView进行展示时推出网约车界面但是不隐藏整个fragment
if (busFragment != null && isTrue) {
busFragment.hideOchBus();
}
}
};
}

View File

@@ -0,0 +1,127 @@
package com.mogo.och.bus.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.mogo.och.bus.R;
import com.mogo.och.bus.bean.OchBusStation;
import com.mogo.och.bus.constant.OchBusConst;
import com.mogo.och.bus.view.VerticalDashLineView;
import java.util.ArrayList;
import java.util.List;
/**
* Station Panel 中的车站列表adapter
*
* @author tongchenfei
*/
public class OchBusStationAdapter extends RecyclerView.Adapter<OchBusStationAdapter.ViewHolder> {
private final Context context;
private final List<OchBusStation> stationList = new ArrayList<>();
private int currentStation;
public OchBusStationAdapter(Context context) {
this.context = context;
}
public void refreshStationList(List<OchBusStation> stationList) {
this.stationList.clear();
this.stationList.addAll(stationList);
for (int i = 0; i < stationList.size(); i++) {
OchBusStation station = stationList.get(i);
if (station.getIsCurrentSite() == OchBusConst.STATION_STATUS_ARRIVING || station.getIsCurrentSite() == OchBusConst.STATION_STATUS_STOPPED ) {
currentStation = i;
break;
}
}
notifyDataSetChanged();
}
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new ViewHolder(LayoutInflater.from(context).inflate(R.layout.item_och_bus_station, parent, false));
}
@Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
// Logger.d("OchBusStationAdapter", "position: " + position + " currPos: " + currentStation + " station: " + stationList.get(position));
holder.tvStationName.setText(stationList.get(position).getSiteName());
if (position == currentStation) {
if (currentStation == 0) {
// 在起始点
holder.tvStationName.setTextColor(context.getResources().getColor(R.color.module_mogo_och_bus_arrived_station_name_text_color));
holder.ivIcon.setImageResource(R.drawable.module_mogo_och_icon_arrived_station);
holder.vDashBottom.setColor(context.getResources().getColor(R.color.module_mogo_och_bus_not_arrive_dash_color));
} else {
holder.tvStationName.setTextColor(context.getResources().getColor(R.color.module_mogo_och_bus_current_station_name_text_color));
holder.ivIcon.setImageResource(R.drawable.module_mogo_och_icon_arriving_station);
holder.vDashTop.setGradient(context.getResources().getColor(R.color.module_mogo_och_bus_arriving_start_dash_color), context.getResources().getColor(R.color.module_mogo_och_bus_arriving_end_dash_color));
holder.vDashBottom.setColor(context.getResources().getColor(R.color.module_mogo_och_bus_not_arrive_dash_color));
}
} else if (position < currentStation) {
// 驶过
holder.tvStationName.setTextColor(context.getResources().getColor(R.color.module_mogo_och_bus_arrived_station_name_text_color));
holder.ivIcon.setImageResource(R.drawable.module_mogo_och_icon_arrived_station);
if (position == currentStation - 1) {
holder.vDashBottom.setGradient(context.getResources().getColor(R.color.module_mogo_och_bus_leaving_start_dash_color), context.getResources().getColor(R.color.module_mogo_och_bus_leaving_end_dash_color));
holder.vDashTop.setColor(context.getResources().getColor(R.color.module_mogo_och_bus_arrived_dash_color));
} else {
holder.vDashTop.setColor(context.getResources().getColor(R.color.module_mogo_och_bus_arrived_dash_color));
holder.vDashBottom.setColor(context.getResources().getColor(R.color.module_mogo_och_bus_arrived_dash_color));
}
} else {
holder.tvStationName.setTextColor(context.getResources().getColor(R.color.module_mogo_och_bus_not_arrive_station_name_text_color));
holder.ivIcon.setImageResource(R.drawable.module_mogo_och_bus_icon_not_arrive_station);
holder.vDashTop.setColor(context.getResources().getColor(R.color.module_mogo_och_bus_not_arrive_dash_color));
holder.vDashBottom.setColor(context.getResources().getColor(R.color.module_mogo_och_bus_not_arrive_dash_color));
}
if (position == 0) {
holder.tvStationNotice.setText("起点");
holder.tvStationNotice.setVisibility(View.VISIBLE);
holder.vDashTop.setVisibility(View.GONE);
holder.vDashBottom.setVisibility(View.VISIBLE);
} else if (position == getItemCount() - 1) {
holder.tvStationNotice.setText("终点");
holder.tvStationNotice.setVisibility(View.VISIBLE);
holder.vDashTop.setVisibility(View.VISIBLE);
holder.vDashBottom.setVisibility(View.GONE);
} else {
holder.tvStationNotice.setVisibility(View.GONE);
holder.vDashTop.setVisibility(View.VISIBLE);
holder.vDashBottom.setVisibility(View.VISIBLE);
}
}
@Override
public int getItemCount() {
return stationList.size();
}
static class ViewHolder extends RecyclerView.ViewHolder {
ImageView ivIcon;
TextView tvStationName;
TextView tvStationNotice;
VerticalDashLineView vDashBottom, vDashTop;
public ViewHolder(@NonNull View itemView) {
super(itemView);
ivIcon = itemView.findViewById(R.id.module_mogo_och_bus_station_icon);
tvStationName = itemView.findViewById(R.id.module_mogo_och_bus_station_name);
tvStationNotice = itemView.findViewById(R.id.module_mogo_och_bus_station_notice);
vDashTop = itemView.findViewById(R.id.module_mogo_och_bus_station_top_dash);
vDashBottom = itemView.findViewById(R.id.module_mogo_och_bus_station_bottom_dash);
}
}
}

View File

@@ -0,0 +1,15 @@
package com.mogo.och.bus.bean;
import java.util.List;
public
/**
* @author congtaowang
* @since 2021/3/23
* <p>
* 小巴达到站点,推送需要下车的乘客列表
*/
class OchBusArriveAtStationMsg {
}

View File

@@ -0,0 +1,24 @@
package com.mogo.och.bus.bean;
/**
* 公交驶离车站,同步服务端请求参数封装
*
* @author tongchenfei
*/
public class OchBusLeaveStationRequest {
private final String sn;
private final int siteId;
public OchBusLeaveStationRequest(String sn, int siteId) {
this.sn = sn;
this.siteId = siteId;
}
public String getSn() {
return sn;
}
public int getSiteId() {
return siteId;
}
}

View File

@@ -0,0 +1,33 @@
package com.mogo.och.bus.bean;
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
import com.mogo.commons.network.Utils;
import com.mogo.utils.network.utils.Util;
public
/**
* @author congtaowang
* @since 2021/3/22
*
* 小巴车运营状态请求参数
*/
class OchBusOperationStatusRequest {
public String sn;
// 0 - 关闭、1 - 启动
public String status;
public OchBusOperationStatusRequest() {
this.sn = MoGoAiCloudClientConfig.getInstance().getSn();
}
public OchBusOperationStatusRequest shutdown() {
status = "0";
return this;
}
public OchBusOperationStatusRequest launch() {
status = "1";
return this;
}
}

View File

@@ -0,0 +1,24 @@
package com.mogo.och.bus.bean;
import com.mogo.commons.data.BaseData;
public
/**
* @author congtaowang
* @since 2021/3/22
*
* 小巴车运营状态请求参数
*/
class OchBusOperationStatusResponse extends BaseData {
public Result result;
public static class Result {
public String id;
public String sn;
public String areaCode;
public String plateNumber;
public int status;
}
}

View File

@@ -0,0 +1,227 @@
package com.mogo.och.bus.bean;
import java.util.List;
public
/**
* @author congtaowang
* @since 2021/3/23
* <p>
* 小巴订单
*/
class OchBusOrder {
/**
* _id : bf014b186a0d417e8086f324e5cbcd1d
* orderNo : XB20210324000002
* orderType : 10
* userName : 星期一
* userPhone : 15555555555
* startStationId : 1
* startStation : 万集东门站
* startStationCoordinate : [116.7354579447,40.1974932972]
* endStationId : 2
* endStation : 顺密路口站
* endStationCoordinate : [116.7215386924,40.194019209]
* orderDispatchType : 1
* carNum : 京NB007
* sn : F803BB2037EZD00088
* orderStartTime : Mar 24, 2021 12:51:51 PM
* orderEndTime : Mar 24, 2021 1:38:13 PM
* cityCode : 010
* areaCode : 1001
* createTime : Mar 24, 2021 12:51:51 PM
* updateTime : Mar 24, 2021 1:38:13 PM
* travelDistance : 1.2
*/
private String _id;
private String orderNo;
private int orderType;
private String userName;
private String userPhone;
private int startStationId;
private String startStation;
private int endStationId;
private String endStation;
private int orderDispatchType;
private String carNum;
private String sn;
private String orderStartTime;
private String orderEndTime;
private String cityCode;
private String areaCode;
private String createTime;
private String updateTime;
private double travelDistance;
private List< Double > startStationCoordinate;
private List< Double > endStationCoordinate;
public String get_id() {
return _id;
}
public void set_id( String _id ) {
this._id = _id;
}
public String getOrderNo() {
return orderNo;
}
public void setOrderNo( String orderNo ) {
this.orderNo = orderNo;
}
public int getOrderType() {
return orderType;
}
public void setOrderType( int orderType ) {
this.orderType = orderType;
}
public String getUserName() {
return userName;
}
public void setUserName( String userName ) {
this.userName = userName;
}
public String getUserPhone() {
return userPhone;
}
public void setUserPhone( String userPhone ) {
this.userPhone = userPhone;
}
public int getStartStationId() {
return startStationId;
}
public void setStartStationId( int startStationId ) {
this.startStationId = startStationId;
}
public String getStartStation() {
return startStation;
}
public void setStartStation( String startStation ) {
this.startStation = startStation;
}
public int getEndStationId() {
return endStationId;
}
public void setEndStationId( int endStationId ) {
this.endStationId = endStationId;
}
public String getEndStation() {
return endStation;
}
public void setEndStation( String endStation ) {
this.endStation = endStation;
}
public int getOrderDispatchType() {
return orderDispatchType;
}
public void setOrderDispatchType( int orderDispatchType ) {
this.orderDispatchType = orderDispatchType;
}
public String getCarNum() {
return carNum;
}
public void setCarNum( String carNum ) {
this.carNum = carNum;
}
public String getSn() {
return sn;
}
public void setSn( String sn ) {
this.sn = sn;
}
public String getOrderStartTime() {
return orderStartTime;
}
public void setOrderStartTime( String orderStartTime ) {
this.orderStartTime = orderStartTime;
}
public String getOrderEndTime() {
return orderEndTime;
}
public void setOrderEndTime( String orderEndTime ) {
this.orderEndTime = orderEndTime;
}
public String getCityCode() {
return cityCode;
}
public void setCityCode( String cityCode ) {
this.cityCode = cityCode;
}
public String getAreaCode() {
return areaCode;
}
public void setAreaCode( String areaCode ) {
this.areaCode = areaCode;
}
public String getCreateTime() {
return createTime;
}
public void setCreateTime( String createTime ) {
this.createTime = createTime;
}
public String getUpdateTime() {
return updateTime;
}
public void setUpdateTime( String updateTime ) {
this.updateTime = updateTime;
}
public double getTravelDistance() {
return travelDistance;
}
public void setTravelDistance( double travelDistance ) {
this.travelDistance = travelDistance;
}
public List< Double > getStartStationCoordinate() {
return startStationCoordinate;
}
public void setStartStationCoordinate( List< Double > startStationCoordinate ) {
this.startStationCoordinate = startStationCoordinate;
}
public List< Double > getEndStationCoordinate() {
return endStationCoordinate;
}
public void setEndStationCoordinate( List< Double > endStationCoordinate ) {
this.endStationCoordinate = endStationCoordinate;
}
}

View File

@@ -0,0 +1,32 @@
package com.mogo.och.bus.bean;
/**
* 重置车站状态请求参数
*
* @author tongchenfei
*/
public class OchBusResetRequest {
private String sn;
private int siteId;
public OchBusResetRequest(String sn, int siteId) {
this.sn = sn;
this.siteId = siteId;
}
public String getSn() {
return sn;
}
public void setSn(String sn) {
this.sn = sn;
}
public int getSiteId() {
return siteId;
}
public void setSiteId(int siteId) {
this.siteId = siteId;
}
}

View File

@@ -0,0 +1,42 @@
package com.mogo.och.bus.bean;
/**
* 网约车小巴路线请求参数封装
*
* @author tongchenfei
*/
public class OchBusRoutesRequest {
double lat;
double lon;
String sn;
public OchBusRoutesRequest(String sn, double lat, double lon) {
this.lat = lat;
this.lon = lon;
this.sn = sn;
}
public double getLat() {
return lat;
}
public void setLat(double lat) {
this.lat = lat;
}
public double getLon() {
return lon;
}
public void setLon(double lon) {
this.lon = lon;
}
public String getSn() {
return sn;
}
public void setSn(String sn) {
this.sn = sn;
}
}

View File

@@ -0,0 +1,27 @@
package com.mogo.och.bus.bean;
import com.mogo.commons.data.BaseData;
/**
* 网约车小巴路线接口请求响应结果
*
* @author tongchenfei
*/
public class OchBusRoutesResponse extends BaseData {
private OchBusRoutesResult result;
public OchBusRoutesResult getResult() {
return result;
}
public void setResult(OchBusRoutesResult result) {
this.result = result;
}
@Override
public String toString() {
return "OchBusRoutesResponse{" +
"result=" + result +
'}';
}
}

View File

@@ -0,0 +1,27 @@
package com.mogo.och.bus.bean;
import java.util.List;
/**
* 网约车小巴路线接口返回接口数据封装
*
* @author tongchenfei
*/
public class OchBusRoutesResult {
private List<OchBusStation> site;
public List<OchBusStation> getSite() {
return site;
}
public void setSite(List<OchBusStation> site) {
this.site = site;
}
@Override
public String toString() {
return "OchBusRoutesResult{" +
"site=" + site +
'}';
}
}

View File

@@ -0,0 +1,154 @@
package com.mogo.och.bus.bean;
/**
* 单个网约车小巴车站信息
*
* @author tongchenfei
*/
public class OchBusStation {
private int lineId;
private int siteId;
private String siteName;
private String cityCode;
private String areaCode;
private String areaName;
private double lat;
private double lon;
private String siteDesc;
private int siteState;
private int isCurrentSite;// @see OchBusConst 是否是当前站 1是 2下一站 0普通站
private int siteColor;
private String peoples;
private int ifStop; // 是否需要停靠、1需要、0不需要
public int getIfStop() {
return ifStop;
}
public void setIfStop( int ifStop ) {
this.ifStop = ifStop;
}
public int getLineId() {
return lineId;
}
public void setLineId(int lineId) {
this.lineId = lineId;
}
public int getSiteId() {
return siteId;
}
public void setSiteId(int siteId) {
this.siteId = siteId;
}
public String getSiteName() {
return siteName;
}
public void setSiteName(String siteName) {
this.siteName = siteName;
}
public String getCityCode() {
return cityCode;
}
public void setCityCode(String cityCode) {
this.cityCode = cityCode;
}
public String getAreaCode() {
return areaCode;
}
public void setAreaCode(String areaCode) {
this.areaCode = areaCode;
}
public String getAreaName() {
return areaName;
}
public void setAreaName(String areaName) {
this.areaName = areaName;
}
public double getLat() {
return lat;
}
public void setLat(double lat) {
this.lat = lat;
}
public double getLon() {
return lon;
}
public void setLon(double lon) {
this.lon = lon;
}
public String getSiteDesc() {
return siteDesc;
}
public void setSiteDesc(String siteDesc) {
this.siteDesc = siteDesc;
}
public int getSiteState() {
return siteState;
}
public void setSiteState(int siteState) {
this.siteState = siteState;
}
public int getIsCurrentSite() {
return isCurrentSite;
}
public void setIsCurrentSite(int isCurrentSite) {
this.isCurrentSite = isCurrentSite;
}
public int getSiteColor() {
return siteColor;
}
public void setSiteColor(int siteColor) {
this.siteColor = siteColor;
}
public String getPeoples() {
return peoples;
}
public void setPeoples(String peoples) {
this.peoples = peoples;
}
@Override
public String toString() {
return "OchBusStation{" +
"lineId=" + lineId +
", siteId=" + siteId +
", siteName='" + siteName + '\'' +
", cityCode='" + cityCode + '\'' +
", areaCode='" + areaCode + '\'' +
", areaName='" + areaName + '\'' +
", lat=" + lat +
", lon=" + lon +
", siteDesc='" + siteDesc + '\'' +
", siteState=" + siteState +
", isCurrentSite=" + isCurrentSite +
", siteColor=" + siteColor +
", peoples='" + peoples + '\'' +
'}';
}
}

View File

@@ -0,0 +1,15 @@
package com.mogo.och.bus.bean;
import java.util.List;
public
/**
* @author congtaowang
* @since 2021/3/25
*
* 小巴站点信息变更:停靠状态等
*/
class OchBusStationsChangedMsg {
public List< OchBusStation > data;
}

View File

@@ -0,0 +1,44 @@
package com.mogo.och.bus.bean;
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
import com.mogo.commons.network.Utils;
/**
* 查询下车乘客请求参数
*
* @author tongchenfei
*/
public class QueryLeaveAwayPassengersRequest {
private String sn;
private int endSiteId;
private int orderDispatchType = 4;
public QueryLeaveAwayPassengersRequest(int siteId) {
this.sn = MoGoAiCloudClientConfig.getInstance().getSn();
this.endSiteId = siteId;
}
public String getSn() {
return sn;
}
public void setSn(String sn) {
this.sn = sn;
}
public int getEndSiteId() {
return endSiteId;
}
public void setEndSiteId(int endSiteId) {
this.endSiteId = endSiteId;
}
public int getOrderDispatchType() {
return orderDispatchType;
}
public void setOrderDispatchType(int orderDispatchType) {
this.orderDispatchType = orderDispatchType;
}
}

View File

@@ -0,0 +1,83 @@
package com.mogo.och.bus.bean;
import com.mogo.commons.data.BaseData;
import java.util.List;
public
/**
* @author congtaowang
* @since 2021/3/26
*
* 到站查询下车乘客
*/
class QueryLeaveAwayPassengersResponse extends BaseData {
public Result result;
public static class Result {
public List< LeaveAwayPassenger > info;
}
public static class LeaveAwayPassenger {
/**
* _id : 9a3b0aacb5f241eabb5ed9f8615d9af6
* orderNo : XB20210324000001
* orderType : 10
* userName : 星期一
* userPhone : 15555555555
* startStationId : 1
* startStation : 万集东门站
* startStationCoordinate : [116.7354579447,40.1974932972]
* endStationId : 2
* endStation : 顺密路口站
* endStationCoordinate : [116.7215386924,40.194019209]
* orderDispatchType : 1
* carNum : 京NB007
* sn : F803BB2037EZD00088
* orderStartTime : 2021-03-24 11:51:24
* orderEndTime :
* arrivedStartStationTime :
* arrivedEndStationTime :
* cityCode : 010
* areaCode : 1001
* createTime : 2021-03-24 11:51:24
* updateTime : 2021-03-24 12:32:10
* personNum :
* travelDistance : 1.2
* vehicleColour :
* lastBrandName :
* headImgUrl :
*/
public String _id;
public String orderNo;
public int orderType;
public String userName;
public String userPhone;
public int startStationId;
public String startStation;
public int endStationId;
public String endStation;
public int orderDispatchType;
public String carNum;
public String sn;
public String orderStartTime;
public String orderEndTime;
public String arrivedStartStationTime;
public String arrivedEndStationTime;
public String cityCode;
public String areaCode;
public String createTime;
public String updateTime;
public String personNum;
public double travelDistance;
public String vehicleColour;
public String lastBrandName;
public String headImgUrl;
public List< Double > startStationCoordinate;
public List< Double > endStationCoordinate;
}
}

View File

@@ -0,0 +1,20 @@
package com.mogo.och.bus.bean;
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
import com.mogo.commons.network.Utils;
public
/**
* @author congtaowang
* @since 2021/3/22
*
* 小巴车运营状态请求参数
*/
class QueryOchBusOperationStatusRequest {
public String sn;
public QueryOchBusOperationStatusRequest() {
this.sn = MoGoAiCloudClientConfig.getInstance().getSn();
}
}

View File

@@ -0,0 +1,24 @@
package com.mogo.och.bus.bean;
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
import com.mogo.commons.network.Utils;
public
/**
* @author congtaowang
* @since 2021/3/22
*
* 小巴车运营状态请求参数
*/
class UpdateSiteStatusRequest {
public String sn;
// 0 - 关闭、1 - 启动
public int siteId;
public UpdateSiteStatusRequest( int siteId ) {
this.sn = MoGoAiCloudClientConfig.getInstance().getSn();
this.siteId = siteId;
}
}

View File

@@ -0,0 +1,19 @@
package com.mogo.och.bus.constant;
/**
* 常量
*
* @author tongchenfei
*/
public class OchBusConst {
// 测试用的广播
public static final String BROADCAST_TEST_BUS_CONTROL_TYPE_EXTRA_KEY = "sceneType";
// 无状态
public static final int STATION_STATUS_IDLE = 0;
// 到站
public static final int STATION_STATUS_STOPPED = 1;
// 离开某一站
public static final int STATION_STATUS_LEAVING = 2;
// 下一站
public static final int STATION_STATUS_ARRIVING = 3;
}

View File

@@ -0,0 +1,237 @@
package com.mogo.och.bus.fragment;
import android.view.View;
import android.widget.TextView;
import androidx.annotation.NonNull;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.commons.voice.AIAssist;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.och.BaseOchFragment;
import com.mogo.och.bus.R;
import com.mogo.och.bus.bean.OchBusStation;
import com.mogo.och.bus.presenter.OchBusPresenter;
import com.mogo.och.view.SlidePanelView;
import com.mogo.service.adas.IMogoAdasOCHCallback;
import com.mogo.utils.TipToast;
import com.mogo.utils.logger.Logger;
import java.util.List;
/**
* 网约车小巴界面
*
* @author tongchenfei
*/
public class OchBusFragment extends BaseOchFragment< OchBusFragment, OchBusPresenter > implements SlidePanelView.OnSlidePanelMoveToEndListener {
private static final String TAG = "OchBusFragment";
private TextView mCurrentStationName;
private TextView mStartStationFlag;
private TextView mNextStationName;
private TextView mEndStationFlag;
private View mBus;
@Override
protected void initViews() {
super.initViews();
mBus = findViewById( R.id.module_och_bus_tag );
mCurrentStationName = findViewById( R.id.module_och_bus_current_station );
mStartStationFlag = findViewById( R.id.module_och_bus_start_station_tag );
mNextStationName = findViewById( R.id.module_och_bus_order_end_station );
mEndStationFlag = findViewById( R.id.module_och_bus_end_station_tag );
if ( DebugConfig.isDebug() ) {
mBus.setOnClickListener( view -> {
TipToast.shortTip( "重置了车站状态" );
mPresenter.debugResetStationStatus();
} );
mBus.setOnLongClickListener( view -> {
getActivity().finish();
return true;
} );
}
Logger.d( TAG, "initView: " + MogoApisHandler.getInstance().getApis().getAdasControllerApi().getAutopilotStatus() );
// 初始化的时候设置 UI 按钮状态
switch ( MogoApisHandler.getInstance().getApis().getAdasControllerApi().getAutopilotStatus() ) {
case IMogoAdasOCHCallback.STATUS_AUTOPILOT_DISABLE:
hideAutopilotBiz();
break;
case IMogoAdasOCHCallback.STATUS_AUTOPILOT_ENABLE:
showAutopilotBiz();
onAutopilotStatusChanged( false );
break;
case IMogoAdasOCHCallback.STATUS_AUTOPILOT_RUNNING:
showAutopilotBiz();
onAutopilotStatusChanged( true );
break;
default:
break;
}
}
@NonNull
@Override
protected OchBusPresenter createPresenter() {
return new OchBusPresenter( this );
}
@Override
public void onResume() {
super.onResume();
}
/**
* 根据站点列表信息刷新车站面板,滑块面板
*
* @param stationList 车站列表信息
* @param currentStation 当前站点
* @param nextStation 下个站点
*/
public void refreshBusStations( List< OchBusStation > stationList, int currentStation, int nextStation ) {
if ( getActivity() == null ) {
return;
}
getActivity().runOnUiThread( () -> {
if ( stationList == null ) {
// 获取小巴数据失败
Logger.e("liyz", " stationList == null ");
return;
}
// 渲染小巴路线数据
renderCurrentStationStatus( stationList, currentStation, nextStation );
} );
}
/**
* 重新刷新站点信息
*/
private void renderCurrentStationStatus( List< OchBusStation > stationList, int currentStation, int nextStation ) {
String currentStationName = null;
String nextStationName = null;
int startStationFlagVisibility = View.INVISIBLE;
int endStationFlagVisibility = View.INVISIBLE;
boolean isArriveEndStation = false;
boolean isArriveAtStation = false;
boolean isArriveAtStartStation = false;
// 获取当前站点的名称
currentStationName = stationList.get( currentStation ).getSiteName();
// 是否到达起点
if ( currentStation == 0 ) {
startStationFlagVisibility = View.VISIBLE;
isArriveAtStartStation = true;
mStartStationFlag.setText( "" );
}
// 是否到达站点
else if ( currentStation > 0 && currentStation < stationList.size() - 1 ) {
isArriveAtStation = true;
}
// 是否到达终点
else if ( currentStation == stationList.size() - 1 ) {
isArriveEndStation = true;
nextStationName = "--";
mStartStationFlag.setText( "" );
startStationFlagVisibility = View.VISIBLE;
endStationFlagVisibility = View.INVISIBLE;
}
// 获取下一站点名称
if ( nextStation > currentStation && nextStation <= stationList.size() - 1 ) {
nextStationName = stationList.get( nextStation ).getSiteName();
}
// 是否到达终点
if ( nextStation == stationList.size() - 1 ) {
endStationFlagVisibility = View.VISIBLE;
}
// 重置滑动按钮文字
if ( isArriveEndStation ) {
showSlidePanle( "单程结束" );
} else if ( isArriveAtStartStation ) {
showSlidePanle( "滑动出发" );
} else if ( isArriveAtStation ) {
showSlidePanle( "滑动出发" );
}
Logger.d("liyz", "renderCurrentStationStatus -----> ");
mCurrentStationName.setText( currentStationName );
mNextStationName.setText( nextStationName );
mStartStationFlag.setVisibility( startStationFlagVisibility );
mEndStationFlag.setVisibility( endStationFlagVisibility );
}
public void hideOchBus() {
// tvNotice.setVisibility(View.GONE);
}
@Override
public int getStationPanelViewId() {
return R.layout.fragment_och_bus;
}
@Override
public void restartAutopilot() {
mPresenter.restartAutopilot();
}
@Override
public SlidePanelView.OnSlidePanelMoveToEndListener getSlidePanelOnEndListener() {
return this;
}
@Override
public void moveToEnd() {
// 开启自动驾驶到下一站
mPresenter.autoDriveToNextStation(false);
}
/**
* 设置自动驾驶可用状态
*/
public void onAutopilotEnableChange( boolean isEnable ) {
onAutopilotStatusChanged(isEnable);
if ( isEnable ) {
showAutopilotBiz();
} else {
hideAutopilotBiz();
}
}
@Override
protected void onChangeOperationStatus() {
super.onChangeOperationStatus();
mPresenter.onChangeOperationStatus();
// TODO 临时解决因为首次请求Http-DNS是北京的bug后续需要考虑Http-DNS状态变化后向外同步的逻辑
mPresenter.queryBusRoutes();
}
/**
* 修改经营状态
* @param launch true-收车false-出车
*/
public void changeOperationStatus( boolean launch ) {
isOperationStatus = launch;
if ( launch ) {
tvOperationStatus.setText( "收车" );
// showSlidePanle("滑动出发");
showPanel();
} else {
AIAssist.getInstance(getContext()).speakTTSVoice("已收车");
tvOperationStatus.setText("出车");
hideSlidePanel();
hidPanel();
}
}
}

View File

@@ -0,0 +1,98 @@
package com.mogo.och.bus.net;
import com.mogo.commons.data.BaseData;
import com.mogo.och.bus.bean.OchBusOperationStatusRequest;
import com.mogo.och.bus.bean.OchBusOperationStatusResponse;
import com.mogo.och.bus.bean.OchBusRoutesResponse;
import com.mogo.och.bus.bean.QueryLeaveAwayPassengersRequest;
import com.mogo.och.bus.bean.QueryLeaveAwayPassengersResponse;
import com.mogo.och.bus.bean.QueryOchBusOperationStatusRequest;
import com.mogo.och.bus.bean.UpdateSiteStatusRequest;
import io.reactivex.Observable;
import okhttp3.RequestBody;
import retrofit2.http.Body;
import retrofit2.http.Headers;
import retrofit2.http.POST;
/**
* 小巴车相关接口
*
* @author tongchenfei
* <p>
* wiki: http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=48970072
*/
public interface IOchBusApiService {
/**
* 根据车机坐标获取所在区域全部站点信息
*
* @param requestBody 请求参数
* @return 接口返回数据
*/
@Headers( {"Content-Type:application/json;charset=UTF-8"} )
@POST( "/yycp-onlinecar-hailing/onlineCarHailing/site/querySiteByCoordinate/v1" )
Observable< OchBusRoutesResponse > querySiteByCoordinate( @Body RequestBody requestBody );
/**
* 公交车驶离车站时,通知服务端
*
* @param requestBody 请求参数 {"sn":"","siteId":"车站id"}
* @return 无返回值
*/
@Headers( {"Content-Type:application/json;charset=UTF-8"} )
@POST( "/yycp-onlinecar-hailing/onlineCarHailing/site/siteCrashCheck/v1" )
Observable< OchBusRoutesResponse > leaveStation( @Body RequestBody requestBody );
/**
* 调试用重置接口
*
* @param requestBody 请求参数{"siteId":1,"sn":"F803EB2046PZD00229"}
* @return 返回值是重置后的车站列表
*/
@Headers( {"Content-Type:application/json;charset=UTF-8"} )
@POST( "/yycp-onlinecar-hailing/onlineCarHailing/site/resetSiteByCoordinate/v1" )
Observable< OchBusRoutesResponse > debugResetStationStatus( @Body RequestBody requestBody );
/**
* 修改小巴运营状态
*
* @param request
* @return
*/
@Headers( {"Content-type:application/json;charset=UTF-8"} )
@POST( "/yycp-onlinecar-hailing/onlineCarHailing/busOrder/updateBusStatus/v1" )
Observable< BaseData > changeOperationStatus( @Body OchBusOperationStatusRequest request );
/**
* 查询小巴运营状态
*
* @param request
* @return
*/
@Headers( {"Content-type:application/json;charset=UTF-8"} )
@POST( "/yycp-onlinecar-hailing/onlineCarHailing/busOrder/queryBusStatus/v1" )
Observable< OchBusOperationStatusResponse > queryOperationStatus( @Body QueryOchBusOperationStatusRequest request );
/**
* 更新到站信息
*
* @param request
* @return
*/
@Headers( {"Content-type:application/json;charset=UTF-8"} )
@POST( "/yycp-onlinecar-hailing/onlineCarHailing/site/siteDynamic/v1" )
Observable< OchBusRoutesResponse > updateSiteStation( @Body UpdateSiteStatusRequest request );
/**
* 到站查询下车乘客
*
* @param request
* @return
*/
@Headers( {"Content-type:application/json;charset=UTF-8"} )
@POST( "/yycp-onlinecar-hailing/onlineCarHailing/busOrder/queryOrderBySiteAndSn/v1" )
Observable< QueryLeaveAwayPassengersResponse > queryStationLeaveAwayPassengers( @Body QueryLeaveAwayPassengersRequest request );
}

View File

@@ -0,0 +1,155 @@
package com.mogo.och.bus.presenter;
import android.content.Context;
import android.os.Looper;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.och.bus.bean.OchBusArriveAtStationMsg;
import com.mogo.och.bus.bean.OchBusOrder;
import com.mogo.och.bus.bean.OchBusStation;
import com.mogo.och.bus.bean.OchBusStationsChangedMsg;
import com.mogo.service.connection.IMogoOnMessageListener;
import com.mogo.utils.UiThreadHandler;
import com.mogo.utils.logger.Logger;
import com.mogo.utils.network.utils.GsonUtil;
import java.util.List;
public
/**
* @author congtaowang
* @since 2021/3/23
*
* 小巴订单管理
*/
class OchBusOrderModel {
private final String TAG = "OchBusOrderModel";
private static volatile OchBusOrderModel sInstance;
public static OchBusOrderModel getInstance() {
if ( sInstance == null ) {
synchronized ( OchBusOrderModel.class ) {
if ( sInstance == null ) {
sInstance = new OchBusOrderModel();
}
}
}
return sInstance;
}
public void init() {
mContext = AbsMogoApplication.getApp();
MogoApisHandler.getInstance()
.getApis()
.getSocketManagerApi( mContext )
.registerOnMessageListener( 401021, mOnOrderListener );
MogoApisHandler.getInstance()
.getApis()
.getSocketManagerApi( mContext )
.registerOnMessageListener( 401020, mOnBusStationsChangedMsg );
}
private Object readResolve() {
// 阻止反序列化,必须实现 Serializable 接口
return sInstance;
}
private Context mContext;
/**
* 小巴订单
* <p>
* 1. 新订单
*/
private IMogoOnMessageListener< OchBusOrder > mOnOrderListener = new IMogoOnMessageListener< OchBusOrder >() {
@Override
public Class< OchBusOrder > target() {
return OchBusOrder.class;
}
@Override
public void onMsgReceived( OchBusOrder obj ) {
Logger.i(TAG, "401021--小巴订单:" + GsonUtil.jsonFromObject(obj));
if ( obj == null ) {
return;
}
runOnUiThread( () -> {
if ( mOnBusOrderChangedListener != null ) {
mOnBusOrderChangedListener.onBusOrderChanged( obj );
}
} );
}
};
/**
* 站点信息变更推送
* 新订单、取消订单、到达站点等都会导致停靠站点变更,故都会收到此推送
*/
private IMogoOnMessageListener< OchBusStationsChangedMsg > mOnBusStationsChangedMsg = new IMogoOnMessageListener< OchBusStationsChangedMsg >() {
@Override
public Class< OchBusStationsChangedMsg > target() {
return OchBusStationsChangedMsg.class;
}
@Override
public void onMsgReceived( OchBusStationsChangedMsg obj ) {
Logger.i(TAG, "401020--站点信息变更推送:" + GsonUtil.jsonFromObject(obj));
if ( obj == null ) {
return;
}
runOnUiThread( () -> {
if ( mOnBusStationsChangedListener != null ) {
mOnBusStationsChangedListener.onBusStationsChanged( obj.data );
}
} );
}
};
private OnBusStationsChangedListener mOnBusStationsChangedListener;
private OnBusOrderChangedListener mOnBusOrderChangedListener;
private OchBusOrderModel() {
}
/**
* 小巴到站
*/
public void onArriveAtStation() {
}
public void setOnBusStationsChangedListener( OnBusStationsChangedListener onBusStationsChangedListener ) {
this.mOnBusStationsChangedListener = onBusStationsChangedListener;
}
public void setOnBusOrderChangedListener( OnBusOrderChangedListener mOnBusOrderChangedListener ) {
this.mOnBusOrderChangedListener = mOnBusOrderChangedListener;
}
/**
* 站点信息
*/
public interface OnBusStationsChangedListener {
void onBusStationsChanged( List< OchBusStation > data );
}
/**
* 站点信息
*/
public interface OnBusOrderChangedListener {
void onBusOrderChanged( OchBusOrder order );
}
private void runOnUiThread( Runnable runnable ) {
if ( Looper.myLooper() == Looper.getMainLooper() ) {
runnable.run();
} else {
UiThreadHandler.postDelayed( runnable, 0 );
}
}
}

View File

@@ -0,0 +1,642 @@
package com.mogo.och.bus.presenter;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.lifecycle.LifecycleOwner;
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
import com.mogo.commons.data.BaseData;
import com.mogo.commons.mvp.Presenter;
import com.mogo.commons.network.SubscribeImpl;
import com.mogo.commons.network.Utils;
import com.mogo.commons.voice.AIAssist;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.constants.HostConst;
import com.mogo.och.bus.bean.OchBusLeaveStationRequest;
import com.mogo.och.bus.bean.OchBusOperationStatusRequest;
import com.mogo.och.bus.bean.OchBusOperationStatusResponse;
import com.mogo.och.bus.bean.OchBusOrder;
import com.mogo.och.bus.bean.OchBusResetRequest;
import com.mogo.och.bus.bean.OchBusRoutesRequest;
import com.mogo.och.bus.bean.OchBusRoutesResponse;
import com.mogo.och.bus.bean.OchBusStation;
import com.mogo.och.bus.bean.QueryLeaveAwayPassengersRequest;
import com.mogo.och.bus.bean.QueryLeaveAwayPassengersResponse;
import com.mogo.och.bus.bean.QueryOchBusOperationStatusRequest;
import com.mogo.och.bus.bean.UpdateSiteStatusRequest;
import com.mogo.och.bus.fragment.OchBusFragment;
import com.mogo.och.bus.net.IOchBusApiService;
import com.mogo.service.adas.IMogoAdasOCHCallback;
import com.mogo.service.adas.RemoteControlAutoPilotParameters;
import com.mogo.service.adas.entity.AdasOCHData;
import com.mogo.utils.logger.Logger;
import com.mogo.utils.network.RequestOptions;
import com.mogo.utils.network.utils.GsonUtil;
import java.util.ArrayList;
import java.util.List;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
import okhttp3.MediaType;
import okhttp3.RequestBody;
import static com.mogo.och.bus.constant.OchBusConst.STATION_STATUS_ARRIVING;
import static com.mogo.och.bus.constant.OchBusConst.STATION_STATUS_LEAVING;
import static com.mogo.och.bus.constant.OchBusConst.STATION_STATUS_STOPPED;
/**
* 网约车小巴
*
* @author tongchenfei
*/
public class OchBusPresenter extends Presenter< OchBusFragment > implements IMogoAdasOCHCallback,
Handler.Callback,
OchBusOrderModel.OnBusStationsChangedListener,
OchBusOrderModel.OnBusOrderChangedListener {
private static final String TAG = "OchBusPresenter";
// 运营类型
private static final int VEHICLE_TYPE = 10;
private static final int MSG_QUERY_BUS_STATION = 1001;
private static final long QUERY_BUS_STATION_DELAY = 5000;
/**
* 用来表示是否正在开往下一站
*/
private boolean isGoingToNextStation = false;
private IOchBusApiService mService;
/**
* 运营状态、后端更具运营状态来判断车辆是否派单
*/
private boolean mIsWorking = false;
public OchBusPresenter( OchBusFragment view ) {
super( view );
mService = MogoApisHandler.getInstance().getApis().getNetworkApi().create( IOchBusApiService.class, HostConst.OCH_DOMAIN );
MogoApisHandler.getInstance().getApis().getAdasControllerApi().addAdasOCHCallback( this );
OchBusOrderModel.getInstance().init();
OchBusOrderModel.getInstance().setOnBusStationsChangedListener( this );
OchBusOrderModel.getInstance().setOnBusOrderChangedListener( this );
}
private final Handler handler = new Handler( this );
private final List< OchBusStation > stationList = new ArrayList<>();
private int currentStationIndex = 0;
@Override
public void onCreate( @NonNull LifecycleOwner owner ) {
super.onCreate( owner );
Log.d(TAG, "onCreate ------> ");
Log.d("liyz", "onCreate ------> ");
queryOperationStatus();
queryBusRoutes();
}
/**
* 查询小巴路线
*/
public void queryBusRoutes() {
Logger.d( TAG, "查询小巴路线");
Logger.d( "liyz", "查询小巴路线------->");
double lat = 40.1974932972;
double lon = 116.7354579447;
lat = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat();
lon = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon();
OchBusRoutesRequest request = new OchBusRoutesRequest( MoGoAiCloudClientConfig.getInstance().getSn(), lat, lon );
RequestBody requestBody = RequestBody.create( MediaType.get( "application/json;charset=UTF-8" ), GsonUtil.jsonFromObject( request ) );
mService.querySiteByCoordinate( requestBody )
.subscribeOn( Schedulers.io() ).observeOn( AndroidSchedulers.mainThread() )
.subscribe( new SubscribeImpl< OchBusRoutesResponse >( RequestOptions.create( getContext() ) ) {
@Override
public void onSuccess( OchBusRoutesResponse o ) {
super.onSuccess( o );
Logger.d( "liyz", "-----1-------- o =" + o);
if ( o == null
|| o.getResult() == null
|| o.getResult().getSite() == null
|| o.getResult().getSite().isEmpty() ) {
Logger.e( "liyz", "-----2-------- ");
return;
}
Logger.d( TAG, "获取到小巴路线数据: " + o );
Logger.d( "liyz", "获取到小巴路线数据: " + o );
renderBusStationsStatus( o.getResult().getSite() );
}
@Override
public void onError( Throwable e ) {
super.onError( e );
Logger.e( TAG, e, "获取小巴路线图失败" );
Logger.d( "liyz", "获取小巴路线图失败 ");
// 重复请求小巴路线,直至成功
queryBusStationDelay();
}
@Override
public void onError( String message, int code ) {
super.onError( message, code );
Logger.e( TAG, "获取小巴路线失败 code: " + code + " msg: " + message );
Logger.e( "liyz", "获取小巴路线失败 code: " + code + " msg: " + message );
// 重复请求小巴路线,直至成功
queryBusStationDelay();
}
} );
}
/**
* 渲染站点信息
*
* @param site
*/
private void renderBusStationsStatus( List< OchBusStation > site ) {
Logger.d( TAG, "渲染站点信息");
Logger.e( "liyz", "渲染站点信息");
int lastStopStation = getNextStopStation();
stationList.clear();
stationList.addAll( site );
for ( int i = 0; i < stationList.size(); i++ ) {
OchBusStation s = stationList.get( i );
// 是否正在开往下一站
if ( s.getIsCurrentSite() == STATION_STATUS_LEAVING ) {
isGoingToNextStation = true;
mView.hideSlidePanel();
}
// 当前站点信息
if ( s.getIsCurrentSite() == STATION_STATUS_LEAVING
|| s.getIsCurrentSite() == STATION_STATUS_STOPPED ) {
currentStationIndex = i;
}
}
mView.refreshBusStations( stationList, currentStationIndex, getNextStopStation() );
if ( isGoingToNextStation ) {
mView.hideSlidePanel();
}
resetNextStopStation( lastStopStation );
}
/**
* 重置下一站
*
* @param lastStopStation
*/
private void resetNextStopStation( int lastStopStation ) {
Logger.d( TAG, "重置下一站");
int nextStopStation = getNextStopStation();
if ( nextStopStation < 0 ) {
return;
}
if ( lastStopStation <= nextStopStation || nextStopStation <= currentStationIndex ) {
return;
}
if ( MogoApisHandler.getInstance().getApis().getAdasControllerApi().getAutopilotStatus()
== IMogoAdasOCHCallback.STATUS_AUTOPILOT_RUNNING ) {
// 自动驾驶中动态设置下一个停靠站点
autoDriveToNextStation( true );
}
}
/**
* 根据订单状态、获取下一站靠站的的站点
*
* @return -1 当前已是最后一个站点
*/
private int getNextStopStation() {
if ( currentStationIndex >= stationList.size() - 1 ) {
return -1;
}
int nextStationIndex = currentStationIndex + 1;
for ( ; nextStationIndex < stationList.size() - 1; nextStationIndex++ ) {
if ( stationList.get( nextStationIndex ).getIfStop() == 1 ) {
break;
}
}
return nextStationIndex;
}
/**
* 延时查询站点信心
*/
private void queryBusStationDelay() {
handler.sendEmptyMessageDelayed( MSG_QUERY_BUS_STATION, QUERY_BUS_STATION_DELAY );
}
/**
* 在踩刹车、控制方向盘等操作后,会停止自动驾驶,重启自动驾驶的话相当于重新设置自动驾驶目的地
*/
public void restartAutopilot() {
Logger.d( TAG, "重启自动驾驶===" + isGoingToNextStation );
if ( isGoingToNextStation ) {
autoDriveToNextStation( true );
}
}
/**
* 测试、重置站点状态
*/
public void debugResetStationStatus() {
Logger.d( TAG, "测试、重置站点状态");
OchBusResetRequest request = new OchBusResetRequest( MoGoAiCloudClientConfig.getInstance().getSn(), 1 );
RequestBody requestBody = RequestBody.create( MediaType.get( "application/json;charset=UTF-8" ), GsonUtil.jsonFromObject( request ) );
mService.debugResetStationStatus( requestBody )
.subscribeOn( Schedulers.io() ).observeOn( AndroidSchedulers.mainThread() )
.subscribe( new SubscribeImpl< OchBusRoutesResponse >( RequestOptions.create( getContext() ) ) {
@Override
public void onSuccess( OchBusRoutesResponse o ) {
super.onSuccess( o );
Logger.d( TAG, "获取到小巴路线数据: " + o );
isGoingToNextStation = false;
if ( o.getResult() == null || o.getResult().getSite() == null || o.getResult().getSite().isEmpty() ) {
return;
}
renderBusStationsStatus( o.getResult().getSite() );
}
@Override
public void onError( Throwable e ) {
super.onError( e );
Logger.e( TAG, e, "获取小巴路线图失败" );
// 重复请求小巴路线,直至成功
queryBusStationDelay();
}
@Override
public void onError( String message, int code ) {
super.onError( message, code );
Logger.e( TAG, "获取小巴路线失败 code: " + code + " msg: " + message );
// 重复请求小巴路线,直至成功
queryBusStationDelay();
}
} );
}
/**
* 开启自动驾驶到下一站
*/
public void autoDriveToNextStation( boolean isRestart ) {
Logger.d( TAG, "开启自动驾驶到下一站");
if ( currentStationIndex >= stationList.size() - 1 ) {
// 当前站是最后一站,结束当前行程
travelOver();
return;
}
OchBusStation currentStation = stationList.get( currentStationIndex );
int nextStationIndex = getNextStopStation();
OchBusStation nextStation = stationList.get( nextStationIndex );
currentStation.setIsCurrentSite( STATION_STATUS_LEAVING );
nextStation.setIsCurrentSite( STATION_STATUS_ARRIVING );
RemoteControlAutoPilotParameters currentAutopilot = new RemoteControlAutoPilotParameters();
currentAutopilot.isSpeakVoice = !isRestart;
currentAutopilot.startLatLon = new RemoteControlAutoPilotParameters.AutoPilotLonLat( currentStation.getLat(), currentStation.getLon() );
currentAutopilot.endLatLon = new RemoteControlAutoPilotParameters.AutoPilotLonLat( nextStation.getLat(), nextStation.getLon() );
currentAutopilot.vehicleType = VEHICLE_TYPE;
Logger.d( TAG, "开启自动驾驶====" + currentAutopilot );
MogoApisHandler.getInstance().getApis().getAdasControllerApi().aiCloudToAdasData( currentAutopilot );
if ( mView != null ) {
mView.refreshBusStations( stationList, currentStationIndex, nextStationIndex );
mView.hideSlidePanel();
}
if ( isGoingToNextStation ) {
// 为了避免恢复自动驾驶时重复的接口请求
return;
}
isGoingToNextStation = true;
AIAssist.getInstance( getContext() ).speakTTSVoice( "欢迎乘坐蘑菇智行无人驾驶小巴车,请您坐好,注意乘车安全,行程即将开始" );
RequestBody request = RequestBody.create( MediaType.get( "application/json" ), GsonUtil.jsonFromObject( new OchBusLeaveStationRequest( MoGoAiCloudClientConfig.getInstance().getSn(), stationList.get( currentStationIndex ).getSiteId() ) ) );
mService.leaveStation( request ).subscribeOn( Schedulers.io() )
.observeOn( AndroidSchedulers.mainThread() )
.subscribe( new SubscribeImpl< OchBusRoutesResponse >( RequestOptions.create( getContext() ) ) {
@Override
public void onSuccess( OchBusRoutesResponse o ) {
super.onSuccess( o );
if ( o.getResult() == null || o.getResult().getSite() == null || o.getResult().getSite().isEmpty() ) {
return;
}
renderBusStationsStatus( o.getResult().getSite() );
}
@Override
public void onError( String message, int code ) {
super.onError( message, code );
Logger.d( TAG, "leave station error: " + message );
}
@Override
public void onError( Throwable e ) {
super.onError( e );
Logger.e( TAG, e, "leave station exception" );
}
} );
}
@Override
public void onArriveAt( AdasOCHData data ) {
if ( currentStationIndex >= stationList.size() - 1 ) {
Logger.e( TAG, "到站异常,取消后续操作" );
return;
}
Logger.d( TAG, "到站====" );
isGoingToNextStation = false;
// 到达站点后,更新站点状态
currentStationIndex = getNextStopStation();
updateSiteStation();
queryLeaveAwayPassengers();
}
/**
* 到站后重置站点状态
*/
private void updateSiteStation() {
Logger.d( TAG, "到站后重置站点状态");
mService.updateSiteStation( new UpdateSiteStatusRequest( stationList.get( currentStationIndex ).getSiteId() ) )
.subscribeOn( Schedulers.io() )
.observeOn( AndroidSchedulers.mainThread() )
.subscribe( new SubscribeImpl< OchBusRoutesResponse >( RequestOptions.create( getContext() ) ) {
@Override
public void onSuccess( OchBusRoutesResponse o ) {
super.onSuccess( o );
if ( o.getResult() == null && o.getResult().getSite() == null || o.getResult().getSite().isEmpty() ) {
return;
}
renderBusStationsStatus( o.getResult().getSite() );
}
@Override
public void onError( String message, int code ) {
super.onError( message, code );
Logger.d( TAG, "leave station error: " + message );
}
@Override
public void onError( Throwable e ) {
super.onError( e );
Logger.e( TAG, e, "leave station exception" );
}
} );
}
/**
* 查询到站下车乘客
*/
private void queryLeaveAwayPassengers() {
Logger.d( TAG, "查询到站下车乘客");
mService.queryStationLeaveAwayPassengers( new QueryLeaveAwayPassengersRequest( stationList.get( currentStationIndex ).getSiteId() ) )
.subscribeOn( Schedulers.io() )
.observeOn( AndroidSchedulers.mainThread() )
.subscribe( new SubscribeImpl< QueryLeaveAwayPassengersResponse >( RequestOptions.create( getContext() ) ) {
@Override
public void onSuccess( QueryLeaveAwayPassengersResponse o ) {
super.onSuccess( o );
playLeavePassengersMsg( o );
}
@Override
public void onError( String message, int code ) {
super.onError( message, code );
Logger.d( TAG, "leave station error: " + message );
}
@Override
public void onError( Throwable e ) {
super.onError( e );
Logger.e( TAG, e, "leave station exception" );
}
} );
}
/**
* 播报下车乘客信息
*
* @param awayPassengersResponse
*/
private void playLeavePassengersMsg( QueryLeaveAwayPassengersResponse awayPassengersResponse ) {
Logger.d( TAG, "播报下车乘客信息");
if ( currentStationIndex > stationList.size() - 1 ) {
return;
}
String station = stationList.get( currentStationIndex ).getSiteName();
StringBuilder builder = new StringBuilder( "已到达" );
builder.append( station );
if ( !station.endsWith( "" ) ) {
builder.append( "" );
}
if ( awayPassengersResponse == null || awayPassengersResponse.result == null || awayPassengersResponse.result.info == null || awayPassengersResponse.result.info.isEmpty() ) {
//
} else {
builder.append( ",请尾号为" );
for ( QueryLeaveAwayPassengersResponse.LeaveAwayPassenger leaveAwayPassenger : awayPassengersResponse.result.info ) {
if ( leaveAwayPassenger == null ) {
continue;
}
String tailNum = leaveAwayPassenger.userPhone.substring( leaveAwayPassenger.userPhone.length() - 4 );
builder.append( tailNum ).append( "," );
}
builder.append( "的乘客下车" );
}
builder.append( ",带好随身物品,下车请注意安全" );
AIAssist.getInstance( getContext() ).speakTTSVoice( builder.toString() );
}
/**
* 行程结束
*/
private void travelOver() {
Logger.d( TAG, "行程结束");
if ( currentStationIndex >= stationList.size() ) {
Logger.e( TAG, "travel over index out of station list" );
return;
}
Logger.d( TAG, "单程结束====" );
MogoApisHandler.getInstance().getApis().getAdasControllerApi().cancelAutopilot();
AIAssist.getInstance( getContext() ).speakTTSVoice( "感谢您体验蘑菇出行无人驾驶小巴车,请您携带好随身物品,我们下次再见" );
RequestBody request = RequestBody.create( MediaType.get( "application/json" ), GsonUtil.jsonFromObject( new OchBusLeaveStationRequest( MoGoAiCloudClientConfig.getInstance().getSn(), stationList.get( currentStationIndex ).getSiteId() ) ) );
mService.leaveStation( request ).subscribeOn( Schedulers.io() )
.observeOn( AndroidSchedulers.mainThread() )
.subscribe( new SubscribeImpl< OchBusRoutesResponse >( RequestOptions.create( getContext() ) ) {
@Override
public void onSuccess( OchBusRoutesResponse o ) {
super.onSuccess( o );
// 始发站改为Stoped其他站改为Idle
Logger.d( TAG, "单程真的结束了====" );
if ( o.getResult() == null || o.getResult().getSite() == null || o.getResult().getSite().isEmpty() ) {
return;
}
renderBusStationsStatus( o.getResult().getSite() );
}
@Override
public void onError( String message, int code ) {
super.onError( message, code );
Logger.d( TAG, "leave station error: " + message );
}
@Override
public void onError( Throwable e ) {
super.onError( e );
Logger.e( TAG, e, "leave station exception" );
}
} );
}
@Override
public void onStateChanged( int state, String reason ) {
Logger.d( TAG, "onStateChange: " + state );
switch ( state ) {
case IMogoAdasOCHCallback.STATUS_AUTOPILOT_ENABLE:
// 设置UI【自动驾驶】按钮是否展示
mView.onAutopilotEnableChange( true );
// 改变UI自动驾驶状态
mView.onAutopilotStatusChanged( false );
if ( isGoingToNextStation ) {
mView.hideSlidePanel();
}
break;
case IMogoAdasOCHCallback.STATUS_AUTOPILOT_RUNNING:
// 改变UI自动驾驶状态
mView.onAutopilotStatusChanged( true );
break;
default:
mView.onAutopilotEnableChange( false );
break;
}
}
@Override
public boolean handleMessage( Message msg ) {
if ( msg.what == MSG_QUERY_BUS_STATION ) {
queryBusRoutes();
return true;
}
return false;
}
public boolean isWorking() {
return mIsWorking;
}
/**
* 修改小巴运营状态
*/
public void onChangeOperationStatus() {
Logger.d( TAG, "修改小巴运营状态");
mService.changeOperationStatus( isWorking() ? new OchBusOperationStatusRequest().shutdown() : new OchBusOperationStatusRequest().launch() )
.subscribeOn( Schedulers.io() )
.observeOn( AndroidSchedulers.mainThread() )
.subscribe( new SubscribeImpl< BaseData >( RequestOptions.create( getContext() ) ) {
@Override
public void onSuccess( BaseData o ) {
super.onSuccess( o );
mIsWorking = !mIsWorking;
if ( mIsWorking ) {
if ( stationList != null && stationList.size() > 0 ) {
AIAssist.getInstance( getContext() ).speakTTSVoice( "车辆已整备完毕,请前往" + stationList.get( 0 ).getSiteName() + "站点" );
}
}
if ( mView != null ) {
mView.changeOperationStatus( isWorking() );
}
}
@Override
public void onError( String message, int code ) {
super.onError( message, code );
Logger.d( TAG, "leave station error: " + message );
}
@Override
public void onError( Throwable e ) {
super.onError( e );
Logger.e( TAG, e, "leave station exception" );
}
} );
}
/**
* 查询运营状态
*/
public void queryOperationStatus() {
Logger.d( TAG, "查询运营状态");
mService.queryOperationStatus( new QueryOchBusOperationStatusRequest() )
.subscribeOn( Schedulers.io() )
.observeOn( AndroidSchedulers.mainThread() )
.subscribe( new SubscribeImpl< OchBusOperationStatusResponse >( RequestOptions.create( getContext() ) ) {
@Override
public void onSuccess( OchBusOperationStatusResponse o ) {
super.onSuccess( o );
if ( o.result != null ) {
mIsWorking = o.result.status == 1;
}
if ( mView != null ) {
mView.changeOperationStatus( isWorking() );
}
}
@Override
public void onError( String message, int code ) {
super.onError( message, code );
Logger.d( TAG, "查询运营状态 error: " + message );
}
@Override
public void onError( Throwable e ) {
super.onError( e );
Logger.e( TAG, e, "查询运营状态 exception" );
}
} );
}
@Override
public void onBusStationsChanged( List< OchBusStation > data ) {
renderBusStationsStatus( data );
}
@Override
public void onBusOrderChanged( OchBusOrder order ) {
if ( order == null ) {
return;
}
if ( TextUtils.isEmpty( order.getUserPhone() ) ) {
return;
}
try {
String tailNum = order.getUserPhone().substring( order.getUserPhone().length() - 4 );
AIAssist.getInstance( getContext() ).speakTTSVoice( "接到新订单,尾号" + tailNum + "上车站点为" + order.getStartStation() );
} catch ( Exception e ) {
e.printStackTrace();
}
}
}

View File

@@ -0,0 +1,40 @@
package com.mogo.och.bus.receiver;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import com.mogo.och.bus.constant.OchBusConst;
import com.mogo.utils.logger.Logger;
/**
* 测试小巴车的场景
*
* @author donghongyu
* @date 4/26/21 12:08 PM
*/
public class TestOchBusBroadcastReceiver extends BroadcastReceiver {
private static final String TAG = "TestOchBusBroadcastReceiver";
private Context mContext;
@Override
public void onReceive(Context context, Intent intent) {
try {
this.mContext = context;
int sceneType = intent.getIntExtra(OchBusConst.BROADCAST_TEST_BUS_CONTROL_TYPE_EXTRA_KEY, 0);
Logger.d(TAG, "sceneType:" + sceneType);
// 分发场景
dispatchSceneTest(sceneType);
} catch (Exception e) {
e.printStackTrace();
}
}
private void dispatchSceneTest(int sceneType) {
}
}

View File

@@ -0,0 +1,37 @@
package com.mogo.och.bus.view;
import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import androidx.constraintlayout.widget.ConstraintLayout;
import com.mogo.commons.debug.DebugConfig;
/**
* 强制拦截所有touch时间的约束布局
*
* @author tongchenfei
*/
public class NoTouchConstraintLayout extends ConstraintLayout {
public NoTouchConstraintLayout(Context context) {
super(context);
}
public NoTouchConstraintLayout(Context context, AttributeSet attrs) {
super(context, attrs);
}
public NoTouchConstraintLayout(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
if(DebugConfig.isDebug()){
return super.onInterceptTouchEvent(ev);
}else {
return true;
}
}
}

View File

@@ -0,0 +1,64 @@
package com.mogo.och.bus.view;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.DashPathEffect;
import android.graphics.LinearGradient;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.Shader;
import android.util.AttributeSet;
import android.view.View;
import androidx.annotation.Nullable;
/**
* 垂直虚线
*
* @author tongchenfei
*/
public class VerticalDashLineView extends View {
public VerticalDashLineView(Context context) {
this(context,null);
}
public VerticalDashLineView(Context context, @Nullable AttributeSet attrs) {
this(context, attrs,0);
}
public VerticalDashLineView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init();
}
private final Paint linePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
private final Path dashPath = new Path();
private void init(){
linePaint.setColor(Color.GREEN);
linePaint.setStyle(Paint.Style.STROKE);
linePaint.setStrokeWidth(2);
linePaint.setPathEffect(new DashPathEffect(new float[]{5, 5}, 0));
}
public void setGradient(int startColor, int endColor) {
LinearGradient linearGradient = new LinearGradient(0, 0, getWidth(), getHeight(), startColor, endColor, Shader.TileMode.CLAMP);
linePaint.setShader(linearGradient);
invalidate();
}
public void setColor(int color) {
linePaint.setShader(null);
linePaint.setColor(color);
invalidate();
}
@Override
protected void onDraw(Canvas canvas) {
dashPath.reset();
dashPath.moveTo((float) getWidth()/2, 0);
dashPath.lineTo((float) getWidth()/2,getHeight());
canvas.drawPath(dashPath,linePaint);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 338 B

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="line">
<stroke
android:width="6px"
android:dashGap="5px"
android:dashWidth="5px"
android:color="@color/module_mogo_och_bus_current_station_notice_text_color" />
<gradient
android:startColor="#f00"
android:endColor="#0f0" />
</shape>

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:left="-600dp"
android:right="-600dp">
<rotate
android:drawable="@drawable/module_mogo_och_bus_station_green_dash_line"
android:visible="true"
android:fromDegrees="90" />
</item>
</layer-list>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#2B6EFF"/>
<corners android:radius="33px"/>
</shape>

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<corners android:radius="32px" />
<solid android:color="#3B4577"/>
</shape>
</item>
<item
android:bottom="3px"
android:left="3px"
android:right="3px"
android:top="3px">
<shape>
<corners android:radius="32px" />
<solid android:color="#3B4577"/>
</shape>
</item>
</layer-list>

View File

@@ -0,0 +1,145 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="@dimen/module_mogo_och_autopilot_order_bg_width"
android:layout_height="@dimen/module_mogo_och_autopilot_order_bg_height"
android:background="@drawable/module_och_bus_panel_bkg"
android:orientation="vertical">
<TextView
android:id="@+id/module_och_bus_tag"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_marginTop="@dimen/module_mogo_och_autopilot_order_tag_m_t"
android:layout_marginRight="@dimen/module_mogo_och_autopilot_order_tag_m_r"
android:background="@drawable/module_och_bus_panel_anchor_bkg"
android:paddingLeft="@dimen/module_mogo_och_autopilot_order_tag_p_r"
android:paddingTop="2px"
android:paddingRight="@dimen/module_mogo_och_autopilot_order_tag_p_r"
android:paddingBottom="2px"
android:text="小巴车"
android:textColor="#FFF"
android:textSize="@dimen/module_mogo_och_autopilot_order_tag_height"
android:textStyle="bold" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/module_och_bus_order_status_stationInfo"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/module_och_bus_order_status_stationInfo_paddingLeft"
android:paddingTop="@dimen/module_och_bus_order_status_stationInfo_paddingTop"
android:paddingRight="@dimen/module_och_bus_order_status_stationInfo_paddingRight"
android:paddingBottom="@dimen/module_och_bus_order_status_stationInfo_paddingBottom">
<TextView
android:id="@+id/module_och_bus_current_station_anchor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="14px"
android:text="当前站点:"
android:textColor="#8E9DD4"
android:textSize="@dimen/module_och_bus_order_start_station_anchor_textSize"
android:textStyle="bold"
app:layout_constraintLeft_toRightOf="@+id/greenDot"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/module_och_bus_current_station"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6px"
android:text="--"
android:textColor="#FFF"
android:textSize="@dimen/module_mogo_och_bus_station_name_text_size"
android:textStyle="bold"
app:layout_constraintLeft_toLeftOf="@+id/module_och_bus_current_station_anchor"
app:layout_constraintTop_toBottomOf="@+id/module_och_bus_current_station_anchor"
tools:text="后路站" />
<TextView
android:id="@+id/module_och_bus_start_station_tag"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="始"
android:textColor="#8E9DD4"
android:textSize="@dimen/module_mogo_och_bus_station_notice_text_size"
android:textStyle="bold"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="@+id/module_och_bus_current_station"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@+id/module_och_bus_current_station"
tools:visibility="visible" />
<TextView
android:id="@+id/module_och_bus_next_station_anchor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/module_och_bus_order_distance_anchor_marginTop"
android:text="下一站:"
android:textColor="#8E9DD4"
android:textSize="@dimen/module_och_bus_order_start_station_anchor_textSize"
android:textStyle="bold"
app:layout_constraintLeft_toLeftOf="@+id/module_och_bus_current_station"
app:layout_constraintTop_toBottomOf="@+id/module_och_bus_current_station" />
<TextView
android:id="@+id/module_och_bus_order_end_station"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="--"
android:textColor="#FFF"
android:textSize="@dimen/module_mogo_och_bus_station_name_text_size"
android:textStyle="bold"
app:layout_constraintLeft_toLeftOf="@+id/module_och_bus_next_station_anchor"
app:layout_constraintTop_toBottomOf="@+id/module_och_bus_next_station_anchor"
tools:text="后路站1" />
<TextView
android:id="@+id/module_och_bus_end_station_tag"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="终"
android:textColor="#8E9DD4"
android:textSize="@dimen/module_mogo_och_bus_station_notice_text_size"
android:textStyle="bold"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="@+id/module_och_bus_order_end_station"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@+id/module_och_bus_order_end_station"
tools:visibility="visible" />
<ImageView
android:id="@+id/greenDot"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="14px"
android:src="@drawable/module_mogo_och_icon_arrived_station"
app:layout_constraintBottom_toBottomOf="@+id/module_och_bus_current_station"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="@+id/module_och_bus_current_station" />
<ImageView
android:id="@+id/dotLine"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:scaleType="fitXY"
android:src="@drawable/module_och_dot_line"
app:layout_constraintBottom_toTopOf="@+id/blueDot"
app:layout_constraintLeft_toLeftOf="@+id/greenDot"
app:layout_constraintRight_toRightOf="@+id/greenDot"
app:layout_constraintTop_toBottomOf="@+id/greenDot" />
<ImageView
android:id="@+id/blueDot"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/module_mogo_och_icon_arriving_station"
app:layout_constraintBottom_toBottomOf="@+id/module_och_bus_order_end_station"
app:layout_constraintLeft_toLeftOf="@+id/greenDot"
app:layout_constraintTop_toTopOf="@+id/module_och_bus_order_end_station" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>

View File

@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.mogo.och.bus.view.VerticalDashLineView
android:id="@+id/module_mogo_och_bus_station_bottom_dash"
android:layout_width="1px"
android:layout_height="30px"
app:layout_constraintLeft_toLeftOf="@id/module_mogo_och_bus_station_icon"
app:layout_constraintRight_toRightOf="@id/module_mogo_och_bus_station_icon"
app:layout_constraintTop_toTopOf="@id/module_mogo_och_bus_station_name"
android:layout_marginTop="15px"/>
<com.mogo.och.bus.view.VerticalDashLineView
android:id="@+id/module_mogo_och_bus_station_top_dash"
android:layout_width="1px"
android:layout_height="30px"
app:layout_constraintBottom_toBottomOf="@id/module_mogo_och_bus_station_name"
android:layout_marginBottom="15px"
app:layout_constraintLeft_toLeftOf="@id/module_mogo_och_bus_station_icon"
app:layout_constraintRight_toRightOf="@id/module_mogo_och_bus_station_icon" />
<ImageView
android:id="@+id/module_mogo_och_bus_station_icon"
android:layout_width="20px"
android:layout_height="20px"
android:scaleType="center"
android:src="@drawable/module_mogo_och_icon_arrived_station"
app:layout_constraintBottom_toBottomOf="@id/module_mogo_och_bus_station_name"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintVertical_bias="0.4"
app:layout_constraintTop_toTopOf="@id/module_mogo_och_bus_station_name" />
<TextView
android:id="@+id/module_mogo_och_bus_station_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/module_mogo_och_bus_station_name_margin_left"
android:text="后鲁站"
android:textColor="@color/module_mogo_och_bus_arrived_station_name_text_color"
android:textSize="@dimen/module_mogo_och_bus_station_name_text_size"
app:layout_constraintLeft_toRightOf="@id/module_mogo_och_bus_station_icon"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
<TextView
android:id="@+id/module_mogo_och_bus_station_notice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="起点"
android:textColor="@color/module_mogo_och_bus_station_notice_text_color"
android:textSize="@dimen/module_mogo_och_bus_station_notice_text_size"
android:layout_marginEnd="10px"
app:layout_constraintBottom_toBottomOf="@id/module_mogo_och_bus_station_name"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@id/module_mogo_och_bus_station_name" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,184 @@
{
"code": 0,
"msg": "",
"detailMsg": "",
"result": {
"info": [
{
"_id": "cee57b3ae07c4486b0357319368487d7",
"orderNo": "XB20210422000002",
"orderType": 10,
"userName": "董QAD",
"userPhone": "15631204018",
"startStationId": 1,
"startStation": "万集东门站",
"startStationCoordinate": [
116.7354579447,
40.1974932972
],
"endStationId": 2,
"endStation": "顺密路口站",
"endStationCoordinate": [
116.721520973,
40.1940181096
],
"orderDispatchType": 7,
"carNum": "京NB010",
"sn": "F803EB2046PZD00149",
"orderStartTime": "2021-04-22 16:31:58",
"orderEndTime": "2021-04-26 10:38:13",
"arrivedStartStationTime": null,
"arrivedEndStationTime": null,
"cityCode": "010",
"areaCode": "1001",
"createTime": "2021-04-22 16:31:58",
"updateTime": "2021-04-26 10:38:13",
"personNum": 1,
"travelDistance": 1.2,
"vehicleColour": null,
"lastBrandName": null,
"headImgUrl": null
},
{
"_id": "ce69b1bcfb9840c6a4563bc6ef947caf",
"orderNo": "XB20210426000000",
"orderType": 10,
"userName": "董QAD",
"userPhone": "15631204018",
"startStationId": 1,
"startStation": "万集东门站",
"startStationCoordinate": [
116.7354579447,
40.1974932972
],
"endStationId": 2,
"endStation": "顺密路口站",
"endStationCoordinate": [
116.721520973,
40.1940181096
],
"orderDispatchType": 7,
"carNum": "京NB010",
"sn": "F803EB2046PZD00149",
"orderStartTime": "2021-04-26 10:38:48",
"orderEndTime": "2021-04-26 10:46:16",
"arrivedStartStationTime": null,
"arrivedEndStationTime": null,
"cityCode": "010",
"areaCode": "1001",
"createTime": "2021-04-26 10:38:48",
"updateTime": "2021-04-26 10:46:16",
"personNum": 1,
"travelDistance": 1.2,
"vehicleColour": null,
"lastBrandName": null,
"headImgUrl": null
},
{
"_id": "cae07b56f41c4e0fa60ab3543ffc258e",
"orderNo": "XB20210426000001",
"orderType": 10,
"userName": "董QAD",
"userPhone": "15631204018",
"startStationId": 1,
"startStation": "万集东门站",
"startStationCoordinate": [
116.7354579447,
40.1974932972
],
"endStationId": 2,
"endStation": "顺密路口站",
"endStationCoordinate": [
116.721520973,
40.1940181096
],
"orderDispatchType": 7,
"carNum": "京NB010",
"sn": "F803EB2046PZD00149",
"orderStartTime": "2021-04-26 10:47:05",
"orderEndTime": "2021-04-26 10:48:07",
"arrivedStartStationTime": null,
"arrivedEndStationTime": null,
"cityCode": "010",
"areaCode": "1001",
"createTime": "2021-04-26 10:47:05",
"updateTime": "2021-04-26 10:48:07",
"personNum": 1,
"travelDistance": 1.2,
"vehicleColour": null,
"lastBrandName": null,
"headImgUrl": null
},
{
"_id": "62bc84afbc434d01b644c74ee406e772",
"orderNo": "XB20210426000002",
"orderType": 10,
"userName": "董QAD",
"userPhone": "15631204018",
"startStationId": 1,
"startStation": "万集东门站",
"startStationCoordinate": [
116.7354579447,
40.1974932972
],
"endStationId": 2,
"endStation": "顺密路口站",
"endStationCoordinate": [
116.721520973,
40.1940181096
],
"orderDispatchType": 7,
"carNum": "京NB010",
"sn": "F803EB2046PZD00149",
"orderStartTime": "2021-04-26 10:48:22",
"orderEndTime": "2021-04-26 10:50:32",
"arrivedStartStationTime": null,
"arrivedEndStationTime": null,
"cityCode": "010",
"areaCode": "1001",
"createTime": "2021-04-26 10:48:22",
"updateTime": "2021-04-26 10:50:32",
"personNum": 1,
"travelDistance": 1.2,
"vehicleColour": null,
"lastBrandName": null,
"headImgUrl": null
},
{
"_id": "fa3214c7a6ec411bb3d6edbc98907423",
"orderNo": "XB20210426000009",
"orderType": 10,
"userName": "董QAD",
"userPhone": "15631204018",
"startStationId": 1,
"startStation": "万集东门站",
"startStationCoordinate": [
116.7354579447,
40.1974932972
],
"endStationId": 2,
"endStation": "顺密路口站",
"endStationCoordinate": [
116.721520973,
40.1940181096
],
"orderDispatchType": 7,
"carNum": "京NB010",
"sn": "F803EB2046PZD00149",
"orderStartTime": "2021-04-26 19:26:05",
"orderEndTime": "2021-04-27 14:35:50",
"arrivedStartStationTime": null,
"arrivedEndStationTime": null,
"cityCode": "010",
"areaCode": "1001",
"createTime": "2021-04-26 19:26:05",
"updateTime": "2021-04-27 14:35:50",
"personNum": 1,
"travelDistance": 1.2,
"vehicleColour": null,
"lastBrandName": null,
"headImgUrl": null
}
]
}
}

View File

@@ -0,0 +1,28 @@
{
"_id": "62bc84afbc434d01b644c74ee406e772",
"areaCode": "1001",
"carNum": "京NB010",
"cityCode": "010",
"createTime": "Apr 26, 2021 10:48:22 AM",
"endStation": "顺密路口站",
"endStationCoordinate": [
116.721520973,
40.1940181096
],
"endStationId": 2,
"orderDispatchType": 1,
"orderNo": "XB20210426000002",
"orderStartTime": "Apr 26, 2021 10:48:22 AM",
"orderType": 10,
"sn": "F803EB2046PZD00149",
"startStation": "万集东门站",
"startStationCoordinate": [
116.7354579447,
40.1974932972
],
"startStationId": 1,
"travelDistance": 1.2,
"updateTime": "Apr 26, 2021 10:48:23 AM",
"userName": "董QAD",
"userPhone": "15631204018"
}

View File

@@ -0,0 +1,69 @@
{
"code": 0,
"msg": "",
"detailMsg": "",
"result": {
"site": [
{
"lineId": 1.0,
"siteId": 1.0,
"siteName": "万集东门站",
"cityCode": "010",
"areaCode": "1001",
"areaName": "顺义区",
"currentLocation": [
116.7354579447,
40.1974932972
],
"lon": 116.7354579447,
"lat": 40.1974932972,
"siteDesc": "万集东门站",
"siteState": 1.0,
"isCurrentSite": 1.0,
"siteColor": 1.0,
"peoples": "0",
"ifStop": 1.0
},
{
"lineId": 1.0,
"siteId": 2.0,
"siteName": "市政府前街18号",
"cityCode": "010",
"areaCode": "1001",
"areaName": "顺义区",
"currentLocation": [
116.729134342,
40.1953113732
],
"lon": 116.729134342,
"lat": 40.1953113732,
"siteDesc": "市政府前街18号",
"siteState": 1.0,
"isCurrentSite": 3.0,
"siteColor": 2.0,
"peoples": "0",
"ifStop": 0.0
},
{
"lineId": 1.0,
"siteId": 3.0,
"siteName": "顺密路口站",
"cityCode": "010",
"areaCode": "1001",
"areaName": "顺义区",
"currentLocation": [
116.721520973,
40.1940181096
],
"lon": 116.721520973,
"lat": 40.1940181096,
"siteDesc": "顺密路口站",
"siteState": 1.0,
"isCurrentSite": 0.0,
"siteColor": 0.0,
"peoples": "0",
"ifStop": 1.0
}
]
}
}

View File

@@ -0,0 +1,109 @@
{
"code": 0,
"msg": "",
"detailMsg": "",
"result": {
"site": [
{
"lineId": 1.0,
"siteId": 1.0,
"siteName": "万集东门站",
"cityCode": "010",
"areaCode": "1001",
"areaName": "顺义区",
"currentLocation": [
116.7354579447,
40.1974932972
],
"lon": 116.7354579447,
"lat": 40.1974932972,
"siteDesc": "万集东门站",
"siteState": 1.0,
"isCurrentSite": 0.0,
"siteColor": 0.0,
"peoples": "0",
"ifStop": 1.0
},
{
"lineId": 1.0,
"siteId": 1.0,
"siteName": "万集东门站",
"cityCode": "010",
"areaCode": "1001",
"areaName": "顺义区",
"currentLocation": [
116.7374429112,
40.2023987087
],
"lon": 116.7374429112,
"lat": 40.2023987087,
"siteDesc": "万集东门站",
"siteState": 1.0,
"isCurrentSite": 0.0,
"siteColor": 0.0,
"peoples": "0",
"ifStop": 1.0
},
{
"lineId": 1.0,
"siteId": 2.0,
"siteName": "顺密路口站",
"cityCode": "010",
"areaCode": "1001",
"areaName": "顺义区",
"currentLocation": [
116.721520973,
40.1940181096
],
"lon": 116.721520973,
"lat": 40.1940181096,
"siteDesc": "顺密路口站",
"siteState": 1.0,
"isCurrentSite": 1.0,
"siteColor": 1.0,
"peoples": "0",
"ifStop": 1.0
},
{
"lineId": 1.0,
"siteId": 2.0,
"siteName": "顺密路口站",
"cityCode": "010",
"areaCode": "1001",
"areaName": "顺义区",
"currentLocation": [
116.723146,
40.179637
],
"lon": 116.723146,
"lat": 40.179637,
"siteDesc": "顺密路口站",
"siteState": 1.0,
"isCurrentSite": 1.0,
"siteColor": 1.0,
"peoples": "0",
"ifStop": 1.0
},
{
"lineId": 2.0,
"siteId": 2.0,
"siteName": "顺密路口站",
"cityCode": "010",
"areaCode": "1001",
"areaName": "顺义区",
"currentLocation": [
116.738835502,
40.2023958306
],
"lon": 116.738835502,
"lat": 40.2023958306,
"siteDesc": "顺密路口站",
"siteState": 1.0,
"isCurrentSite": 1.0,
"siteColor": 1.0,
"peoples": "0",
"ifStop": 1.0
}
]
}
}

View File

@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- 本套资源适配分体机xhdpi -->
<dimen name="module_mogo_och_bus_station_panel_width">300px</dimen>
<dimen name="module_mogo_och_bus_station_panel_height">348px</dimen>
<dimen name="module_mogo_och_bus_two_station_panel_height">211px</dimen>
<dimen name="module_mogo_och_bus_three_station_panel_height">276px</dimen>
<dimen name="module_mogo_och_bus_station_list_height">220px</dimen>
<dimen name="module_mogo_och_bus_two_station_list_height">98px</dimen>
<dimen name="module_mogo_och_bus_three_station_list_height">159px</dimen>
<dimen name="module_mogo_och_bus_current_station_name_text_size">32px</dimen>
<dimen name="module_mogo_och_bus_current_station_notice_text_size">20px</dimen>
<dimen name="module_mogo_och_bus_station_name_text_size">42px</dimen>
<dimen name="module_mogo_och_bus_station_notice_text_size">32px</dimen>
<dimen name="module_mogo_och_bus_station_name_margin_left">15px</dimen>
<dimen name="module_mogo_och_bus_station_panel_padding_top">20px</dimen>
<dimen name="module_mogo_och_bus_station_panel_padding_left">36px</dimen>
<dimen name="module_mogo_och_bus_station_panel_padding_bottom">28px</dimen>
<dimen name="module_mogo_och_bus_station_panel_padding_right">36px</dimen>
<dimen name="module_mogo_och_bus_station_panel_guide_offset_left">3px</dimen>
<dimen name="module_mogo_och_bus_station_panel_guide_offset_right">3px</dimen>
<dimen name="module_mogo_och_bus_station_panel_guide_offset_top">17px</dimen>
<dimen name="module_mogo_och_bus_station_panel_guide_offset_bottom">17px</dimen>
<dimen name="module_och_bus_panel_width">300px</dimen>
<dimen name="module_och_bus_panel_height">270px</dimen>
<dimen name="module_och_bus_order_status_marginLeft">30px</dimen>
<dimen name="module_och_bus_order_status_marginTop">24px</dimen>
<dimen name="module_och_bus_order_status_textSize">24px</dimen>
<dimen name="module_och_bus_order_status_divider_height">1px</dimen>
<dimen name="module_och_bus_order_status_divider_marginLeft">30px</dimen>
<dimen name="module_och_bus_order_status_divider_marginTop">23px</dimen>
<dimen name="module_och_bus_order_status_divider_marginRight">30px</dimen>
<dimen name="module_och_bus_order_status_stationInfo_height">146px</dimen>
<dimen name="module_och_bus_order_status_stationInfo_paddingLeft">20px</dimen>
<dimen name="module_och_bus_order_status_stationInfo_paddingTop">23px</dimen>
<dimen name="module_och_bus_order_status_stationInfo_paddingRight">30px</dimen>
<dimen name="module_och_bus_order_status_stationInfo_paddingBottom">23px</dimen>
<dimen name="module_och_bus_order_start_station_textSize">26px</dimen>
<dimen name="module_och_bus_order_start_station_anchor_textSize">32px</dimen>
<dimen name="module_och_bus_order_end_station_anchor_textSize">20px</dimen>
<dimen name="module_och_bus_order_distance_container_height">80px</dimen>
<dimen name="module_och_bus_order_distance_container_marginLeft">3px</dimen>
<dimen name="module_och_bus_order_distance_anchor_marginTop">44.5px</dimen>
<dimen name="module_och_bus_order_distance_anchor_textSize">20px</dimen>
<dimen name="module_och_bus_order_distance_textSize">28px</dimen>
<dimen name="module_och_bus_order_distance_marginRight">27px</dimen>
<dimen name="module_mogo_och_autopilot_order_tag_height">25.6px</dimen>
<dimen name="module_mogo_och_autopilot_order_tag_m_t">20px</dimen>
<dimen name="module_mogo_och_autopilot_order_tag_m_r">20px</dimen>
<dimen name="module_mogo_och_autopilot_order_tag_p_r">16px</dimen>
<dimen name="module_mogo_och_autopilot_order_tag_p_l">16px</dimen>
</resources>

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="module_mogo_och_bus_current_station_name_text_color">#FF1FA7FF</color>
<color name="module_mogo_och_bus_current_station_notice_text_color">#FFFFFFFF</color>
<color name="module_mogo_och_bus_arrived_station_name_text_color">#FFFFFFFF</color>
<color name="module_mogo_och_bus_not_arrive_station_name_text_color">#FF51649D</color>
<color name="module_mogo_och_bus_station_notice_text_color">#7F8299EB</color>
<color name="module_mogo_och_bus_not_arrive_dash_color">#51649D</color>
<color name="module_mogo_och_bus_arriving_start_dash_color">#427d8e</color>
<color name="module_mogo_och_bus_arriving_end_dash_color">#1FA7FF</color>
<color name="module_mogo_och_bus_leaving_start_dash_color">#3FC281</color>
<color name="module_mogo_och_bus_leaving_end_dash_color">#427d8e</color>
<color name="module_mogo_och_bus_arrived_dash_color">#3FC281</color>
</resources>

View File

@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- 本套资源适配分体机xhdpi -->
<dimen name="module_mogo_och_bus_station_panel_width">300px</dimen>
<dimen name="module_mogo_och_bus_station_panel_height">348px</dimen>
<dimen name="module_mogo_och_bus_two_station_panel_height">211px</dimen>
<dimen name="module_mogo_och_bus_three_station_panel_height">276px</dimen>
<dimen name="module_mogo_och_bus_station_list_height">220px</dimen>
<dimen name="module_mogo_och_bus_two_station_list_height">98px</dimen>
<dimen name="module_mogo_och_bus_three_station_list_height">159px</dimen>
<dimen name="module_mogo_och_bus_current_station_name_text_size">32px</dimen>
<dimen name="module_mogo_och_bus_current_station_notice_text_size">20px</dimen>
<dimen name="module_mogo_och_bus_station_name_text_size">26px</dimen>
<dimen name="module_mogo_och_bus_station_notice_text_size">20px</dimen>
<dimen name="module_mogo_och_bus_station_name_margin_left">15px</dimen>
<dimen name="module_mogo_och_bus_station_panel_padding_top">20px</dimen>
<dimen name="module_mogo_och_bus_station_panel_padding_left">36px</dimen>
<dimen name="module_mogo_och_bus_station_panel_padding_bottom">28px</dimen>
<dimen name="module_mogo_och_bus_station_panel_padding_right">36px</dimen>
<dimen name="module_mogo_och_bus_station_panel_guide_offset_left">3px</dimen>
<dimen name="module_mogo_och_bus_station_panel_guide_offset_right">3px</dimen>
<dimen name="module_mogo_och_bus_station_panel_guide_offset_top">17px</dimen>
<dimen name="module_mogo_och_bus_station_panel_guide_offset_bottom">17px</dimen>
<dimen name="module_och_bus_panel_width">300px</dimen>
<dimen name="module_och_bus_panel_height">270px</dimen>
<dimen name="module_och_bus_order_status_marginLeft">30px</dimen>
<dimen name="module_och_bus_order_status_marginTop">24px</dimen>
<dimen name="module_och_bus_order_status_textSize">24px</dimen>
<dimen name="module_och_bus_order_status_divider_height">1px</dimen>
<dimen name="module_och_bus_order_status_divider_marginLeft">30px</dimen>
<dimen name="module_och_bus_order_status_divider_marginTop">23px</dimen>
<dimen name="module_och_bus_order_status_divider_marginRight">30px</dimen>
<dimen name="module_och_bus_order_status_stationInfo_height">146px</dimen>
<dimen name="module_och_bus_order_status_stationInfo_paddingLeft">20px</dimen>
<dimen name="module_och_bus_order_status_stationInfo_paddingTop">23px</dimen>
<dimen name="module_och_bus_order_status_stationInfo_paddingRight">30px</dimen>
<dimen name="module_och_bus_order_status_stationInfo_paddingBottom">23px</dimen>
<dimen name="module_och_bus_order_start_station_textSize">26px</dimen>
<dimen name="module_och_bus_order_start_station_anchor_textSize">20px</dimen>
<dimen name="module_och_bus_order_end_station_anchor_textSize">20px</dimen>
<dimen name="module_och_bus_order_distance_container_height">80px</dimen>
<dimen name="module_och_bus_order_distance_container_marginLeft">3px</dimen>
<dimen name="module_och_bus_order_distance_anchor_marginTop">27px</dimen>
<dimen name="module_och_bus_order_distance_anchor_textSize">20px</dimen>
<dimen name="module_och_bus_order_distance_textSize">28px</dimen>
<dimen name="module_och_bus_order_distance_marginRight">27px</dimen>
<dimen name="module_mogo_och_autopilot_order_tag_height">16px</dimen>
<dimen name="module_mogo_och_autopilot_order_tag_m_t">16px</dimen>
<dimen name="module_mogo_och_autopilot_order_tag_m_r">16px</dimen>
<dimen name="module_mogo_och_autopilot_order_tag_p_r">16px</dimen>
<dimen name="module_mogo_och_autopilot_order_tag_p_l">16px</dimen>
</resources>

1
OCH/mogo-och-noop/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/build

View File

@@ -0,0 +1,54 @@
apply plugin: 'com.android.library'
apply plugin: 'com.alibaba.arouter'
android {
compileSdkVersion rootProject.ext.android.compileSdkVersion
// buildToolsVersion rootProject.ext.android.buildToolsVersion
defaultConfig {
minSdkVersion rootProject.ext.android.minSdkVersion
targetSdkVersion rootProject.ext.android.targetSdkVersion
versionCode Integer.valueOf(VERSION_CODE)
versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION")
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
javaCompileOptions {
annotationProcessorOptions {
arguments = [AROUTER_MODULE_NAME: project.getName()]
}
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation rootProject.ext.dependencies.androidxappcompat
implementation rootProject.ext.dependencies.arouter
annotationProcessor rootProject.ext.dependencies.aroutercompiler
if (Boolean.valueOf(RELEASE)) {
implementation rootProject.ext.dependencies.mogooch
implementation rootProject.ext.dependencies.mogoutils
implementation rootProject.ext.dependencies.mogocommons
} else {
implementation project(":OCH:mogo-och")
implementation project(":foudations:mogo-utils")
implementation project(":foudations:mogo-commons")
}
}
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()

View File

@@ -0,0 +1,3 @@
GROUP=com.mogo.och
POM_ARTIFACT_ID=och-noop
VERSION_CODE=1

21
OCH/mogo-och-noop/proguard-rules.pro vendored Normal file
View File

@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

View File

@@ -0,0 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mogo.och.bus">
/
</manifest>

View File

@@ -0,0 +1,30 @@
package com.mogo.och.bus;
import android.content.Context;
import androidx.fragment.app.FragmentActivity;
import com.mogo.och.IMogoOCH;
import com.mogo.utils.logger.Logger;
public
/**
* @author congtaowang
* @since 2021/1/15
* <p>
* 描述
*/
class MogoOCHNoop implements IMogoOCH {
private static final String TAG = "MogoOCHNoop";
@Override
public void init( FragmentActivity activity, int containerId ) {
Logger.d( TAG, "noop-" );
}
@Override
public void init( Context context ) {
Logger.d( TAG, "noop-" );
}
}

1
OCH/mogo-och-taxi/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/build

View File

@@ -0,0 +1,58 @@
apply plugin: 'com.android.library'
apply plugin: 'com.alibaba.arouter'
android {
compileSdkVersion rootProject.ext.android.compileSdkVersion
// buildToolsVersion rootProject.ext.android.buildToolsVersion
defaultConfig {
minSdkVersion rootProject.ext.android.minSdkVersion
targetSdkVersion rootProject.ext.android.targetSdkVersion
versionCode Integer.valueOf(VERSION_CODE)
versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION")
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
javaCompileOptions {
annotationProcessorOptions {
arguments = [AROUTER_MODULE_NAME: project.getName()]
}
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation rootProject.ext.dependencies.androidxappcompat
implementation rootProject.ext.dependencies.arouter
annotationProcessor rootProject.ext.dependencies.aroutercompiler
implementation rootProject.ext.dependencies.rxandroid
implementation rootProject.ext.dependencies.androidxconstraintlayout
if (Boolean.valueOf(RELEASE)) {
implementation rootProject.ext.dependencies.mogooch
implementation rootProject.ext.dependencies.mogoutils
implementation rootProject.ext.dependencies.mogocommons
implementation rootProject.ext.dependencies.mogomodulecommon
} else {
implementation project(":OCH:mogo-och")
implementation project(":foudations:mogo-utils")
implementation project(":foudations:mogo-commons")
implementation project(":modules:mogo-module-common")
}
}
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()

View File

@@ -0,0 +1,3 @@
GROUP=com.mogo.och
POM_ARTIFACT_ID=och-taxi
VERSION_CODE=1

21
OCH/mogo-och-taxi/proguard-rules.pro vendored Normal file
View File

@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

View File

@@ -0,0 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mogo.och.taxi">
/
</manifest>

View File

@@ -0,0 +1,13 @@
package com.mogo.och.taxi;
public
/**
* @author congtaowang
* @since 2021/1/26
*
* adas 可自动驾驶状态切换逻辑
*/
interface IMogoADASAutoPilotStatusChangedListener {
void onAutoPilotStatusChanged( int status, String reason );
}

View File

@@ -0,0 +1,33 @@
package com.mogo.och.taxi;
public
/**
* @author congtaowang
* @since 2021/1/18
*
* 网约车-出租车到站回调
*/
interface IMogoOCHTaxiArriveCallback {
void onTheWay2StartStation();
/**
* 到达起始站
*/
void onArriveAtStartStation();
/**
* 到达终点站
*/
void onArriveAtEndStation();
/**
* 去往目的地的路上
*/
void onTheWay2EndStation();
/**
* 乘客已到达站点
*/
void onUserArriveAtStartStation();
}

View File

@@ -0,0 +1,6 @@
package com.mogo.och.taxi;
public interface IOperationChangedListener {
void onOperationChanged(boolean launch);
void onOrderStatusChanged(int status);
}

View File

@@ -0,0 +1,80 @@
package com.mogo.och.taxi;
import android.content.Context;
import androidx.fragment.app.FragmentActivity;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.och.IMogoOCH;
import com.mogo.och.OCHConstants;
import com.mogo.och.taxi.ui.OCHTaxiFragment;
import com.mogo.och.taxi.ui.OCHTaxiUiController;
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
import com.mogo.service.statusmanager.StatusDescriptor;
import com.mogo.utils.UiThreadHandler;
import com.mogo.utils.logger.Logger;
public
/**
* @author congtaowang
* @since 2021/1/15
* <p>
* 网约车-出租车
*/
@Route( path = OCHConstants.PATH )
class MogoOCHTaxi implements IMogoOCH , IMogoStatusChangedListener {
private static final String TAG = "MogoOCHTaxi";
private OCHTaxiFragment ochTaxiFragment;
private FragmentActivity mActivity;
private int mContainerId;
@Override
public void init( FragmentActivity activity, int containerId ) {
this.mActivity = activity;
this.mContainerId = containerId;
// MogoOCHTaxiModel.getInstance().init( activity.getApplicationContext() );
OCHTaxiUiController.getInstance().init( activity, containerId );
UiThreadHandler.postDelayed( () -> {
OCHTaxiUiController.getInstance().stepIntoVrMode();
}, 5_000L );
}
@Override
public void init( Context context ) {
Logger.d( TAG, "init" );
MogoApisHandler.getInstance().getApis().getStatusManagerApi().registerStatusChangedListener("ochTaxi", StatusDescriptor.VR_MODE,this);
MogoApisHandler.getInstance().getApis().getStatusManagerApi().registerStatusChangedListener("ochTaxi", StatusDescriptor.TOP_VIEW,this);
}
private void showFragment() {
if (ochTaxiFragment == null) {
Logger.d(TAG, "准备add fragment======");
ochTaxiFragment = new OCHTaxiFragment();
mActivity.getSupportFragmentManager().beginTransaction().add(mContainerId, ochTaxiFragment).commitAllowingStateLoss();
return;
}
Logger.d(TAG, "准备show fragment");
mActivity.getSupportFragmentManager().beginTransaction().show(ochTaxiFragment).commitAllowingStateLoss();
}
private void hideFragment(){
if (ochTaxiFragment != null){
mActivity.getSupportFragmentManager().beginTransaction().hide(ochTaxiFragment).commitAllowingStateLoss();
}
}
@Override
public void onStatusChanged(StatusDescriptor descriptor, boolean isTrue) {
if (descriptor == StatusDescriptor.VR_MODE){
if (isTrue){
showFragment();
MogoOCHTaxiModel.getInstance().init( mActivity.getApplicationContext() );
}else {
hideFragment();
}
}
}
}

View File

@@ -0,0 +1,915 @@
package com.mogo.och.taxi;
import android.content.Context;
import android.content.Intent;
import android.location.Location;
import android.net.ConnectivityManager;
import com.mogo.cloud.commons.utils.CoordinateUtils;
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
import com.mogo.commons.data.BaseData;
import com.mogo.commons.network.SubscribeImpl;
import com.mogo.map.MogoLatLng;
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.constants.HostConst;
import com.mogo.och.taxi.ui.OCHTaxiUiController;
import com.mogo.service.adas.IMogoAdasOCHCallback;
import com.mogo.service.adas.RemoteControlAutoPilotParameters;
import com.mogo.service.adas.entity.AdasOCHData;
import com.mogo.service.connection.IMogoLifecycleListener;
import com.mogo.service.connection.IMogoOnMessageListener;
import com.mogo.service.intent.IMogoIntentListener;
import com.mogo.utils.NetworkUtils;
import com.mogo.utils.TipToast;
import com.mogo.utils.logger.Logger;
import com.mogo.utils.network.RequestOptions;
import com.mogo.utils.network.utils.GsonUtil;
import com.mogo.utils.storage.SharedPrefsMgr;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
public
/**
* @author congtaowang
* @since 2021/1/15
*
* 网约车 - 出租车业务逻辑处理
*/
class MogoOCHTaxiModel {
private static final String TAG = "MogoOCHTaxiModel";
/**
* 到达起始点围栏
*/
public static final int ARRIVE_AT_START_STATION_DISTANCE = 20;
private static volatile MogoOCHTaxiModel sInstance;
private MogoOCHTaxiModel() {
}
public static MogoOCHTaxiModel getInstance() {
if ( sInstance == null ) {
synchronized ( MogoOCHTaxiModel.class ) {
if ( sInstance == null ) {
sInstance = new MogoOCHTaxiModel();
}
}
}
return sInstance;
}
/**
* 订单信息
*/
public static final String SP_KEY_OCH_TAXI_ORDER = "SP_KEY_OCH_TAXI_ORDER";
private OrderMsgListener mOrderMsgListener;
private OrderStatusMsgListener mOrderStatusMsgListener;
private OCHTaxiServiceApi mOCHTaxiServiceApi;
private Context mContext;
private OCHTaxiOrderResponse mCurrentOCHOrder;
private OCHArriveNotifyCallback mNotifyCallback;
private OCHSocketLifeCycleLisnter mSocketLifeCycleLisnter;
private IMogoCarLocationChangedListener2 mCarLocationChangedListener2;
/**
* 是否达到起始站点
*/
private boolean mIsArriveAtStartStation = false;
/**
* 是否在去往终点站的路上
*/
private boolean mIsOnTheWay2EndStation = false;
/**
* 是否达到终点
*/
private boolean mIsArriveAtEndStation = false;
// /**
// * 乘客已到达上车站点
// */
// private boolean mIsUserArriveAtStartStation = false;
/**
* 查询订单信息重试次数
*/
private int mRetryCounter = 0;
private int mOCHRHCarstatus = -1;
private Object readResolve() {
// 阻止反序列化,必须实现 Serializable 接口
return sInstance;
}
public void init( Context context ) {
mContext = context.getApplicationContext();
if (mOCHTaxiServiceApi == null){
mOCHTaxiServiceApi = MogoApisHandler.getInstance().getApis().getNetworkApi().create(OCHTaxiServiceApi.class, HostConst.OCH_DOMAIN);
}
MogoApisHandler.getInstance()
.getApis()
.getSocketManagerApi( context )
.registerOnMessageListener( 401016, mOrderMsgListener = new OrderMsgListener() );
MogoApisHandler.getInstance()
.getApis()
.getSocketManagerApi( context )
.registerOnMessageListener( 401019, mOrderStatusMsgListener = new OrderStatusMsgListener() );
MogoApisHandler.getInstance()
.getApis()
.getSocketManagerApi(context)
.registerLifecycleListener(10010,mSocketLifeCycleLisnter = new OCHSocketLifeCycleLisnter());
MogoApisHandler.getInstance()
.getApis()
.getAdasControllerApi()
.addAdasOCHCallback( mNotifyCallback = new OCHArriveNotifyCallback() );
MogoApisHandler.getInstance()
.getApis()
.getIntentManagerApi()
.registerIntentListener( ConnectivityManager.CONNECTIVITY_ACTION, mNetWorkIntentListener );
// if ( NetworkUtils.isConnected( mContext ) ) {
// restoreOrderInfo();
// }
if ( NetworkUtils.isConnected( mContext ) ) {
querryCarStatus();
}
}
public void querryCarStatus() {
mOCHTaxiServiceApi.queryCarStatus( new OCHCarStatus (MoGoAiCloudClientConfig.getInstance().getSn(),0))
.subscribeOn(Schedulers.io())
.observeOn( AndroidSchedulers.mainThread() )
.subscribe( new SubscribeImpl< OCHCarStatusResponse >(RequestOptions.create(mContext)) {
@Override
public void onSuccess(OCHCarStatusResponse data) {
super.onSuccess(data);
Logger.e(TAG,"querryCarStatus:"+data.data.status);
mOCHRHCarstatus = data.data.status == 1 ? 1:0;
//更新view
OCHTaxiUiController.getInstance().onOperationChanged(mOCHRHCarstatus==1);
//刷新数据
updateData(mOCHRHCarstatus);
}
@Override
public void onError(Throwable e) {
super.onError(e);
Logger.e(TAG,"querryCarStatus:"+e.getMessage());
}
@Override
public void onError(String message, int code) {
super.onError(message,code);
Logger.e(TAG,"querryCarStatus:"+message);
}
});
}
public void updateData(int status){
if (status == 1){
//查询订单
restoreOrderInfo();
}
}
/**
* 重新恢复订单状态
*/
private void restoreOrderInfo() {
Logger.d( TAG, "重新查询订单状态" );
mRetryCounter = 0;
query2RestoreOrderStatus(null);
}
/**
* 查询订单状态来恢复旧订单因crash导致应用重启、断网没收到推送等状态
* <p>
* 已结束、已取消:清除订单状态
* 已到达目的地更新UI显示到达目的地状态
* 车辆已到达起始地:等待乘客上车,并确认上车
* 乘客已上车更新UI显示已到达起始站等待安全员确认开启自动驾驶
* 在去往目的地的路上:显示去往目的地的路上
* 在去往起始地的路上、未获取具体状态:以新接收订单开始处理
*
* @param orderNo
*/
private void query2RestoreOrderStatus( String orderNo ) {
Logger.e(TAG,"query2RestoreOrderStatus:"+orderNo);
queryOCHOrderStatus( orderNo, new OCHOrderStatusCallback< OCHTaxiOrderResponse2 >() {
@Override
public void onSuccess( OCHTaxiOrderResponse2 data ) {
Logger.d( TAG, "query2RestoreOrderStatus:"+ data.toString());
if ( data == null || data.data == null) {
Logger.d( TAG, "订单已取消或已完成" );
clearCurrentOCHOrder();
OCHTaxiUiController.getInstance().onOrderStatusChanged(OCHOrderStatus.None.getCode());
return;
}
convertCurrentOrder( data );
OCHOrderStatus status = OCHOrderStatus.valueOf( data.data.orderDispatchType );
OCHTaxiUiController.getInstance().onOrderStatusChanged(data.data.orderDispatchType);
switch ( status ) {
case JourneyCompleted:
TipToast.shortTip( mContext.getString( R.string.module_och_taxi_order_completed ) );
clearCurrentOCHOrder();
// OCHTaxiUiController.getInstance().removeFragment();
break;
case Cancel:
TipToast.shortTip( mContext.getString( R.string.module_och_taxi_order_cancel ) );
clearCurrentOCHOrder();
// OCHTaxiUiController.getInstance().removeFragment();
break;
case ArriveAtEndStation:
case UserState:
mIsArriveAtEndStation = true;
mIsArriveAtStartStation = false;
mIsOnTheWay2EndStation = false;
// mIsUserArriveAtStartStation = false;
// OCHTaxiUiController.getInstance().addFragment();
break;
case ArriveAtStartStation:
mIsArriveAtStartStation = true;
mIsArriveAtEndStation = false;
mIsOnTheWay2EndStation = false;
// mIsUserArriveAtStartStation = false;
// OCHTaxiUiController.getInstance().addFragment();
break;
case UserArriveAtStartStation:
mIsArriveAtStartStation = true;
mIsArriveAtEndStation = false;
mIsOnTheWay2EndStation = false;
// mIsUserArriveAtStartStation = true;
// OCHTaxiUiController.getInstance().addFragment();
break;
case OnTheWayToEndStation:
mIsArriveAtStartStation = false;
mIsArriveAtEndStation = false;
mIsOnTheWay2EndStation = true;
// mIsUserArriveAtStartStation = false;
// OCHTaxiUiController.getInstance().addFragment();
break;
case OnTheWayToStartStation:
default:
mIsArriveAtStartStation = false;
mIsArriveAtEndStation = false;
mIsOnTheWay2EndStation = false;
// mIsUserArriveAtStartStation = false;
mOrderMsgListener.onMsgReceived( mCurrentOCHOrder );
break;
}
}
@Override
public void onError() {
if ( mRetryCounter++ > 3 ) {
return;
}
query2RestoreOrderStatus( orderNo );
}
@Override
public void onFail() {
Logger.w( TAG, "查询订单失败" );
}
} );
}
/**
* 用于长连接
* @param orderNo
*/
private void querryOrderStatusForMakeUp( String orderNo ) {
Logger.e(TAG,"querryOrderStatusForMakeUp:"+orderNo);
queryOCHOrderStatus( orderNo, new OCHOrderStatusCallback< OCHTaxiOrderResponse2 >() {
@Override
public void onSuccess( OCHTaxiOrderResponse2 data ) {
if ( data == null || data.data == null) {
Logger.d( TAG, "订单已取消或已完成" );
clearCurrentOCHOrder();
OCHTaxiUiController.getInstance().onOrderStatusChanged(OCHOrderStatus.None.getCode());
return;
}
Logger.d( TAG, "querryOrderStatusForMakeUp:"+ data.data.orderDispatchType);
convertCurrentOrder( data );
OCHOrderStatus status = OCHOrderStatus.valueOf( data.data.orderDispatchType );
switch ( status ) {
case JourneyCompleted:
TipToast.shortTip( mContext.getString( R.string.module_och_taxi_order_completed ) );
OCHTaxiUiController.getInstance().onOrderStatusChanged(data.data.orderDispatchType);
clearCurrentOCHOrder();
break;
case Cancel:
TipToast.shortTip( mContext.getString( R.string.module_och_taxi_order_cancel ) );
OCHTaxiUiController.getInstance().onOrderStatusChanged(data.data.orderDispatchType);
clearCurrentOCHOrder();
break;
case OnTheWayToStartStation:
// default:
mIsArriveAtStartStation = false;
mIsArriveAtEndStation = false;
mIsOnTheWay2EndStation = false;
OCHTaxiUiController.getInstance().onOrderStatusChanged(data.data.orderDispatchType);
mOrderMsgListener.onMsgReceived( mCurrentOCHOrder );
break;
}
}
@Override
public void onError() {
}
@Override
public void onFail() {
Logger.w( TAG, "查询订单失败" );
}
} );
}
/**
* 将查询到的订单转换成推送的订单数据,目前两者数据结构不一样
*
* @param data
*/
private void convertCurrentOrder( OCHTaxiOrderResponse2 data ) {
if (data.data == null){
return;
}
if ( mCurrentOCHOrder == null ) {
mCurrentOCHOrder = new OCHTaxiOrderResponse();
}
mCurrentOCHOrder.orderNo = data.data.orderNo;
mCurrentOCHOrder.orderDispatchType = data.data.orderDispatchType;
mCurrentOCHOrder.endStation = data.data.endStation;
mCurrentOCHOrder.startStation = data.data.startStation;
mCurrentOCHOrder.travelDistance = data.data.travelDistance;
mCurrentOCHOrder.orderType = data.data.orderType;
mCurrentOCHOrder.drivingRoutes = new ArrayList<>();
OCHTaxiOrderResponse.OCHTaxiStation startStation = new OCHTaxiOrderResponse.OCHTaxiStation();
List< Double > startStationCoordinate = data.data.startStationCoordinate;
List< Double > startGcjStationCoordinate = data.data.startGcjStationCoordinate;
if (startStationCoordinate != null && startStationCoordinate.size()>1 &&
startGcjStationCoordinate!= null && startGcjStationCoordinate.size() > 1){
startStation.lon = startGcjStationCoordinate.get( 0 );
startStation.lat = startGcjStationCoordinate.get( 1 );
startStation.wgsLon = startStationCoordinate.get(0);
startStation.wgsLat = startStationCoordinate.get(1);
startStation.siteId = data.data.startStationId;
startStation.siteName = data.data.startStation;
mCurrentOCHOrder.drivingRoutes.add( startStation );
}
OCHTaxiOrderResponse.OCHTaxiStation endStation = new OCHTaxiOrderResponse.OCHTaxiStation();
List< Double > endStationCoordinate = data.data.endStationCoordinate;
List< Double > endGcjStationCoordinate = data.data.endGcjStationCoordinate;
if (endStationCoordinate != null && endStationCoordinate.size()>1 &&
endGcjStationCoordinate!=null && endGcjStationCoordinate.size() > 1){
endStation.lon = endGcjStationCoordinate.get( 0 );
endStation.lat = endGcjStationCoordinate.get( 1 );
endStation.wgsLon = endStationCoordinate.get( 0 );
endStation.wgsLat = endStationCoordinate.get( 1 );
endStation.siteId = data.data.endStationId;
endStation.siteName = data.data.endStation;
mCurrentOCHOrder.drivingRoutes.add( endStation );
}
cacheOrderInfo2Native( mCurrentOCHOrder );
}
/**
* 监听网络变化,避免启动机器时无网导致无法更新订单信息
*/
private IMogoIntentListener mNetWorkIntentListener = new IMogoIntentListener() {
@Override
public void onIntentReceived( String intentStr, Intent intent ) {
Logger.d( TAG, "onIntentReceived = %s", intentStr );
if ( ConnectivityManager.CONNECTIVITY_ACTION.equals( intentStr ) ) {
if ( NetworkUtils.isConnected( mContext ) ) {
// restoreOrderInfo();
querryCarStatus();
}
}
}
};
public void changedOperationStatus() {
if ( mOCHRHCarstatus == -1){
querryCarStatus();
return;
}
if (checkCurrentOCHOrder()){
TipToast.shortTip( "订单未完成,无法下线收车" );
return;
}
int status = mOCHRHCarstatus == 1 ? 0 : 1;
mOCHTaxiServiceApi.updateCarStatus(new OCHCarStatus(MoGoAiCloudClientConfig.getInstance().getSn(),status))
.subscribeOn(Schedulers.io())
.observeOn( AndroidSchedulers.mainThread() )
.subscribe( new SubscribeImpl< OCHCarStatusResponse >(RequestOptions.create(mContext)) {
@Override
public void onSuccess(OCHCarStatusResponse o) {
super.onSuccess(o);
Logger.d(TAG,"OCHCarStatusResponse:"+o.data.status);
mOCHRHCarstatus = o.data.status;
OCHTaxiUiController.getInstance().onOperationChanged(mOCHRHCarstatus == 1);
updateData(mOCHRHCarstatus);
Logger.d(TAG,"changeCarStatus:"+status);
}
@Override
public void onError(Throwable e) {
super.onError(e);
Logger.d(TAG,"changeCarStatus:"+e.getMessage());
}
@Override
public void onError(String message, int code) {
super.onError(message, code);
Logger.d(TAG,"changeCarStatus:"+message);
}
});
}
/**
* 自车定位
*/
private class LocationListener implements IMogoCarLocationChangedListener2 {
@Override
public void onCarLocationChanged2( Location location ) {
// Logger.d( TAG, "定位已判断是否达到上车站点: 起点(%s, %s), 当前位置(%s, %s)",
// mCurrentOCHOrder.drivingRoutes.get( 0 ).lon,
// mCurrentOCHOrder.drivingRoutes.get( 0 ).lat,
// location.getLongitude(),
// location.getLatitude()
// );
onLocationChanged( location );
}
@Override
public void onCarLocationChanged( MogoLatLng latLng ) {
}
}
/**
* 位置变化时,通过围栏({@link #ARRIVE_AT_START_STATION_DISTANCE}M判断是否到达x点
*
* @param location
*/
private void onLocationChanged( Location location ) {
if ( location == null ) {
return;
}
if ( !checkCurrentOCHOrder() ) {
return;
}
if ( mIsArriveAtStartStation ) {
return;
}
// if ( mIsUserArriveAtStartStation ) {
// return;
// }
judgeStartStation( location );
}
/**
* 根据围栏判断,是否到达起点
*
* @param location
*/
private void judgeStartStation( Location location ) {
OCHTaxiOrderResponse.OCHTaxiStation station = mCurrentOCHOrder.drivingRoutes.get( 0 );//起点
double distance = CoordinateUtils.calculateLineDistance( station.lon, station.lat, location.getLongitude(), location.getLatitude() );
if ( distance > ARRIVE_AT_START_STATION_DISTANCE ) {
distance = CoordinateUtils.calculateLineDistance( station.lon, station.lat,
MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon(),
MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat() );
}
if ( distance <= ARRIVE_AT_START_STATION_DISTANCE ) {
mIsArriveAtStartStation = true;
OCHTaxiUiController.getInstance().onArriveAtStartStation();
updateOCHOrderStatus( OCHOrderStatus.ArriveAtStartStation, new OCHOrderStatusCallback() {
@Override
public void onSuccess( Object data ) {
OCHTaxiUiController.getInstance().onOrderStatusChanged(OCHOrderStatus.ArriveAtStartStation.getCode());
Logger.d( TAG, "更新状态成功" );
}
@Override
public void onFail() {
Logger.d( TAG, "更新状态失败" );
}
@Override
public void onError() {
Logger.d( TAG, "更新状态失败2" );
}
} );
return;
}
// Logger.d( TAG, "distance = %s", distance );
}
/**
* 是否已到达起始站
*/
public boolean isArriveAtStartStation() {
return mIsArriveAtStartStation;
}
/**
* 是否已到达终点站
*
* @return
*/
public boolean isArriveAtEndStation() {
return mIsArriveAtEndStation;
}
/**
* 设置去往终点状态
*
* @param isOnTheWay2EndStation
*/
public void setOnTheWay2EndStation( boolean isOnTheWay2EndStation ) {
this.mIsOnTheWay2EndStation = isOnTheWay2EndStation;
OCHTaxiUiController.getInstance().onTheWay2EndStation();
}
/**
* 是否在去往目的地的路上
*
* @return
*/
public boolean isOnTheWay2EndStation() {
return mIsOnTheWay2EndStation;
}
/**
* 后端长链推送通知新订单
*/
private class OrderMsgListener implements IMogoOnMessageListener< OCHTaxiOrderResponse > {
@Override
public Class< OCHTaxiOrderResponse > target() {
return OCHTaxiOrderResponse.class;
}
@Override
public void onMsgReceived( OCHTaxiOrderResponse obj ) {
if ( obj == null ) {
return;
}
if (mOCHRHCarstatus != 1){
return;
}
Logger.d( TAG, "收到新订单" + GsonUtil.jsonFromObject(obj));
mCurrentOCHOrder = obj;
cacheOrderInfo2Native( mCurrentOCHOrder );
Location location = MogoApisHandler.getInstance()
.getApis()
.getMapServiceApi()
.getNavi( mContext )
.getCarLocation2();
onLocationChanged( location );
if ( !isArriveAtStartStation() ) {
registerCarLocationListener();
}
OCHTaxiUiController.getInstance().onOrderStatusChanged(mCurrentOCHOrder.orderDispatchType);
}
}
/**
* 保存订单到本地,避免车机重启丢失数据
*
* @param obj
*/
private void cacheOrderInfo2Native( OCHTaxiOrderResponse obj ) {
if ( obj == null ) {
return;
}
SharedPrefsMgr.getInstance( mContext ).putString( SP_KEY_OCH_TAXI_ORDER, GsonUtil.jsonFromObject( obj ) );
}
/**
* 达到起始站围栏监听
*/
private void registerCarLocationListener() {
MogoApisHandler.getInstance()
.getApis()
.getRegisterCenterApi()
.registerCarLocationChangedListener( TAG,
mCarLocationChangedListener2 == null ? mCarLocationChangedListener2 = new LocationListener() : mCarLocationChangedListener2 );
}
/**
* 注销到达起始站围栏监听
*/
public void unregisterCarLocationListener() {
if ( mCarLocationChangedListener2 == null ) {
return;
}
MogoApisHandler.getInstance()
.getApis()
.getRegisterCenterApi()
.unregisterCarLocationChangedListener( TAG, mCarLocationChangedListener2 );
}
public void unregisterSocketListener(){
MogoApisHandler.getInstance()
.getApis()
.getSocketManagerApi(mContext)
.unregisterLifecycleListener(10010);
}
/**
* 后端长链推送通知订单状态被改变
*/
private class OrderStatusMsgListener implements IMogoOnMessageListener< OCHTaxiOrderStatusResponse > {
@Override
public Class target() {
return OCHTaxiOrderStatusResponse.class;
}
@Override
public void onMsgReceived( OCHTaxiOrderStatusResponse obj ) {
if ( obj == null ) {
return;
}
if (mOCHRHCarstatus != 1){
return;
}
Logger.d(TAG, "订单状态被改变:" + GsonUtil.jsonFromObject(obj));
OCHOrderStatus status = OCHOrderStatus.valueOf( obj.orderDispatchType );
switch ( status ) {
case Cancel:
clearCurrentOCHOrder();
OCHTaxiUiController.getInstance().onOrderStatusChanged(status.getCode());
break;
case UserArriveAtStartStation:
mIsArriveAtStartStation = true;
OCHTaxiUiController.getInstance().onUserArriveAtStartStation();
break;
default:
Logger.d( TAG, "current order status: %s", status );
break;
}
}
}
private class OCHSocketLifeCycleLisnter implements IMogoLifecycleListener {
@Override
public void onConnectFailure() {
Logger.e(TAG,"socket onConnectFailure");
}
@Override
public void onConnectSuccess() {
Logger.e(TAG,"socket onConnectSuccess");
stopSocketMakeUp();
}
@Override
public void onConnectLost() {
Logger.e(TAG,"socket onConnectLost");
startSocketMakeUp();
}
}
public void startSocketMakeUp(){
if (mOCHRHCarstatus == 1){
timeLoop();
}
}
public void stopSocketMakeUp(){
if (mDisposable != null){
mDisposable.dispose();
}
}
/**
* 自动驾驶本地通知订单到站
*/
private class OCHArriveNotifyCallback implements IMogoAdasOCHCallback {
@Override
public void onArriveAt( AdasOCHData data ) {
if ( data == null ) {
return;
}
if ( mIsArriveAtEndStation ) {
return;
}
if ( !checkCurrentOCHOrder() ) {
return;
}
mIsArriveAtEndStation = true;
OCHTaxiUiController.getInstance().onArriveAtEndStation();
}
@Override
public void onStateChanged( int state, String reason ) {
// Logger.d( TAG, "state = %s", state );
OCHTaxiUiController.getInstance().onAutoPilotStatusChanged( state, reason );
}
}
/**
* 更新订单状态
*
* @param orderStatus 订单状态
*/
public void updateOCHOrderStatus( OCHOrderStatus orderStatus, OCHOrderStatusCallback callback ) {
if ( mCurrentOCHOrder == null ) {
return;
}
if ( mOCHTaxiServiceApi == null ) {
mOCHTaxiServiceApi = MogoApisHandler.getInstance().getApis().getNetworkApi().create( OCHTaxiServiceApi.class, HostConst.OCH_DOMAIN );
}
mOCHTaxiServiceApi.updateOrderStatus( new OCHTaxiOrderStatus( MoGoAiCloudClientConfig.getInstance().getSn(), mCurrentOCHOrder.orderNo, orderStatus.getCode() ) )
.subscribeOn( Schedulers.io() )
.observeOn( AndroidSchedulers.mainThread() )
.subscribe( new SubscribeImpl< BaseData >( RequestOptions.create( mContext ) ) {
@Override
public void onSuccess( BaseData o ) {
super.onSuccess( o );
if ( callback != null ) {
callback.onSuccess( o );
}
}
@Override
public void onError( Throwable e ) {
super.onError( e );
if ( callback != null ) {
callback.onError();
}
Logger.e(TAG,"updateOCHOrderStatus:"+e.getMessage());
}
@Override
public void onError( String message, int code ) {
super.onError( message, code );
Logger.e(TAG,"updateOCHOrderStatus:"+message);
if ( callback != null ) {
callback.onFail();
}
}
} );
}
/**
* 查询订单状态
*
* @param orderNo 订单号
*/
public void queryOCHOrderStatus( String orderNo, OCHOrderStatusCallback< OCHTaxiOrderResponse2 > callback ) {
if ( mOCHTaxiServiceApi == null ) {
mOCHTaxiServiceApi = MogoApisHandler.getInstance().getApis().getNetworkApi().create( OCHTaxiServiceApi.class, HostConst.OCH_DOMAIN );
}
mOCHTaxiServiceApi.queryOrder( new OCHTaxiOrderStatus( MoGoAiCloudClientConfig.getInstance().getSn(), orderNo, OCHOrderStatus.None.getCode() ) )
.subscribeOn( Schedulers.io() )
.observeOn( AndroidSchedulers.mainThread() )
.subscribe( new SubscribeImpl< OCHTaxiOrderResponse2 >( RequestOptions.create( mContext ) ) {
@Override
public void onSuccess( OCHTaxiOrderResponse2 o ) {
super.onSuccess( o );
if ( callback != null ) {
callback.onSuccess( o );
}
}
@Override
public void onError( Throwable e ) {
super.onError( e );
if ( callback != null ) {
callback.onError();
}
}
@Override
public void onError( String message, int code ) {
super.onError( message, code );
Logger.e("MogoOCHTaxi","queryOCHOrderStatus:"+message);
if ( callback != null ) {
callback.onFail();
}
}
} );
}
/**
* 清除订单信息
*/
public void clearCurrentOCHOrder() {
mCurrentOCHOrder = null;
mIsArriveAtStartStation = false;
mIsArriveAtEndStation = false;
mIsOnTheWay2EndStation = false;
// mIsUserArriveAtStartStation = false;
SharedPrefsMgr.getInstance( mContext ).remove( SP_KEY_OCH_TAXI_ORDER );
}
/**
* 检测当前订单
*
* @return
*/
public boolean checkCurrentOCHOrder() {
if ( mCurrentOCHOrder != null
&& mCurrentOCHOrder.drivingRoutes != null) {
return true;
}
return false;
}
/**
* 以当前订单为基础,开启自动驾驶
*/
public void startAutoPilot() {
if ( !checkCurrentOCHOrder() ) {
Logger.e( TAG, "no order or order is empty." );
return;
}
RemoteControlAutoPilotParameters parameters = new RemoteControlAutoPilotParameters();
parameters.vehicleType = mCurrentOCHOrder.orderType;
parameters.startLatLon = new RemoteControlAutoPilotParameters.AutoPilotLonLat( mCurrentOCHOrder.drivingRoutes.get( 0 ).wgsLat, mCurrentOCHOrder.drivingRoutes.get( 0 ).wgsLon );
parameters.endLatLon = new RemoteControlAutoPilotParameters.AutoPilotLonLat( mCurrentOCHOrder.drivingRoutes.get( 1 ).wgsLat, mCurrentOCHOrder.drivingRoutes.get( 1 ).wgsLon );
MogoApisHandler.getInstance()
.getApis()
.getAdasControllerApi()
.aiCloudToAdasData( parameters );
Logger.d( TAG, "start autopilot with parameter: %s", GsonUtil.jsonFromObject( parameters ) );
}
/**
* 获取当前订单
*
* @return
*/
public OCHTaxiOrderResponse getCurrentOCHOrder() {
return mCurrentOCHOrder;
}
public void calculateTravelDistance(Location carLocation){
if (mCurrentOCHOrder.drivingRoutes != null && mCurrentOCHOrder.drivingRoutes.size()>0){
OCHTaxiOrderResponse.OCHTaxiStation endStationOCHLocation = mCurrentOCHOrder.drivingRoutes.get(1);
double distance = CoordinateUtils.calculateLineDistance(
endStationOCHLocation.lon, endStationOCHLocation.lat,
carLocation.getLongitude(), carLocation.getLatitude());
mCurrentOCHOrder.decreaseTravelDistance(distance);
}
}
/**
* 结束自动驾驶
*/
public void cancelAutopilot() {
try {
MogoApisHandler.getInstance()
.getApis()
.getAdasControllerApi()
.cancelAutopilot();
Logger.d( TAG, "结束自动驾驶" );
unregisterCarLocationListener();
} catch ( Exception e ) {
e.printStackTrace();
}
}
private static final int PERIOD = 1 * 1000;
private static final int DELAY = 100;
private Disposable mDisposable;
/**
* 定时循环任务
*/
private void timeLoop() {
mDisposable = Observable.interval(DELAY, PERIOD, TimeUnit.MILLISECONDS)
.map((aLong -> aLong + 1))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(aLong -> querryOrderStatusForMakeUp(null));
}
}

View File

@@ -0,0 +1,20 @@
package com.mogo.och.taxi;
import com.mogo.commons.data.BaseData;
public
/**
*
* 修改/查询网约车-出租车订单状态的数据结构
*/
class OCHCarStatus extends BaseData {
public String sn;// 不排除本地没有缓存订单号的情况
public int status; //0 收车 1出车
public OCHCarStatus(String sn,
int status ) {
this.sn = sn;
this.status = status;
}
}

View File

@@ -0,0 +1,29 @@
package com.mogo.och.taxi;
import com.mogo.commons.data.BaseData;
public
/**
*
* 修改/查询网约车-出租车订单状态的数据结构
*/
class OCHCarStatusResponse extends BaseData {
public String sn;// 不排除本地没有缓存订单号的情况
public int status; //0 收车 1出车
public Result data;
public OCHCarStatusResponse(String sn,
int status ) {
this.sn = sn;
this.status = status;
}
public static class Result{
public int id;
public String sn;
public String areaCode;
public String plateNumber;
public int status;
// String remark;
}
}

View File

@@ -0,0 +1,47 @@
package com.mogo.och.taxi;
public
/**
* @author congtaowang
* @since 2021/1/15
*
* 未派单 0
* 去往上车站点 1
* 车辆已到达上车站点 2
* 乘客已到达上车站点 3
* 去往下车站点 4
* 到达下车站点 5
* 已完成 6
* 已取消 7
*/
enum OCHOrderStatus {
None( 0 ),
OnTheWayToStartStation( 1 ),
ArriveAtStartStation( 2 ),
UserArriveAtStartStation( 3 ),
OnTheWayToEndStation( 4 ),
ArriveAtEndStation( 5 ),
UserState( 6 ),//小程序用的状态 车机不处理
Cancel( 7 ),
JourneyCompleted(8);//行程完成
private int code;
OCHOrderStatus( int code ) {
this.code = code;
}
public int getCode() {
return code;
}
public static OCHOrderStatus valueOf( int code ) {
for ( OCHOrderStatus value : OCHOrderStatus.values() ) {
if ( value.code == code ) {
return value;
}
}
return None;
}
}

View File

@@ -0,0 +1,19 @@
package com.mogo.och.taxi;
public
/**
* @author congtaowang
* @since 2021/1/15
*
* 修改订单状态回调接口
*/
interface OCHOrderStatusCallback< T > {
void onSuccess( T data );
void onFail();
default void onError() {
}
}

View File

@@ -0,0 +1,142 @@
package com.mogo.och.taxi;
import android.os.Parcel;
import android.os.Parcelable;
import java.util.List;
public
/**
* @author congtaowang
* @since 2021/1/15
*
* 描述
*/
class OCHTaxiOrderResponse implements Parcelable {
// 订单号
public String orderNo;
// 订单运营类型 9出租车10小巴
public int orderType;
// 起始站名称
public String startStation;
// 目的站名称
public String endStation;
// 当前订单状态
public int orderDispatchType;
// 起始站目的站距离km
public double travelDistance;
// 站点
public List< OCHTaxiStation > drivingRoutes;
/**
* @param distance
*/
public void decreaseTravelDistance( double distance ) {
travelDistance = ( ( float ) distance / 1000f );
if ( travelDistance < 0 ) {
travelDistance = 0;
}
}
public static class OCHTaxiStation implements Parcelable {
public String siteId;
public String siteName;
public double lon;// 用于计算距离
public double lat;
public double wgsLon;//用于自动驾驶
public double wgsLat;
public OCHTaxiStation() {
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel( Parcel dest, int flags ) {
dest.writeString( this.siteId );
dest.writeString( this.siteName );
dest.writeDouble( this.lon );
dest.writeDouble( this.lat );
dest.writeDouble( this.wgsLon );
dest.writeDouble( this.wgsLat );
}
protected OCHTaxiStation( Parcel in ) {
this.siteId = in.readString();
this.siteName = in.readString();
this.lon = in.readDouble();
this.lat = in.readDouble();
this.wgsLon = in.readDouble();
this.wgsLat = in.readDouble();
}
public static final Creator< OCHTaxiStation > CREATOR = new Creator< OCHTaxiStation >() {
@Override
public OCHTaxiStation createFromParcel( Parcel source ) {
return new OCHTaxiStation( source );
}
@Override
public OCHTaxiStation[] newArray( int size ) {
return new OCHTaxiStation[size];
}
};
}
public OCHTaxiOrderResponse() {
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel( Parcel dest, int flags ) {
dest.writeString( this.orderNo );
dest.writeInt( this.orderType );
dest.writeString( this.startStation );
dest.writeString( this.endStation );
dest.writeInt( this.orderDispatchType );
dest.writeDouble( this.travelDistance );
dest.writeTypedList( this.drivingRoutes );
}
protected OCHTaxiOrderResponse( Parcel in ) {
this.orderNo = in.readString();
this.orderType = in.readInt();
this.startStation = in.readString();
this.endStation = in.readString();
this.orderDispatchType = in.readInt();
this.travelDistance = in.readDouble();
this.drivingRoutes = in.createTypedArrayList( OCHTaxiStation.CREATOR );
}
public static final Creator< OCHTaxiOrderResponse > CREATOR = new Creator< OCHTaxiOrderResponse >() {
@Override
public OCHTaxiOrderResponse createFromParcel( Parcel source ) {
return new OCHTaxiOrderResponse( source );
}
@Override
public OCHTaxiOrderResponse[] newArray( int size ) {
return new OCHTaxiOrderResponse[size];
}
};
@Override
public String toString() {
return "OCHTaxiResponse{" +
"orderNo='" + orderNo + '\'' +
", orderType=" + orderType +
", startStation='" + startStation + '\'' +
", endStation='" + endStation + '\'' +
", orderDispatchType=" + orderDispatchType +
", travelDistance=" + travelDistance +
", drivingRoutes=" + drivingRoutes +
'}';
}
}

View File

@@ -0,0 +1,64 @@
package com.mogo.och.taxi;
import com.mogo.commons.data.BaseData;
import java.util.List;
public
/**
* @author congtaowang
* @since 2021/1/15
*
* 描述
*/
class OCHTaxiOrderResponse2 extends BaseData {
public Result data;
public static class Result {
public String _id;
// 订单号
public String orderNo;
// 订单运营类型 9出租车10小巴
public int orderType;
// 当前订单状态
public int orderDispatchType;
// 起始站目的站距离km
public double travelDistance;
public String userName;
public String userPhone;
// 起始站名称
public String startStation;
// 起始站ID
public String startStationId;
// 起点站点
public List< Double > startStationCoordinate;
public List< Double > startGcjStationCoordinate;//高德坐标系 用于距离计算
// 目的站名称
public String endStation;
// 目的站ID
public String endStationId;
// 终点站点
public List< Double > endStationCoordinate;
public List< Double > endGcjStationCoordinate;//高德坐标系 用于距离计算
public String orderStartTime;
public String cityCode;
public String areaCode;
public String createTime;
public String updateTime;
public int personNum;
public String headImgUrl;
public String lastBrandName;
public String arrivedStartStationTime;
public String arrivedEndStationTime;
public String sn;
public String carNum;
}
}

View File

@@ -0,0 +1,24 @@
package com.mogo.och.taxi;
public
/**
* @author congtaowang
* @since 2021/1/15
*
* 修改/查询网约车-出租车订单状态的数据结构
*/
class OCHTaxiOrderStatus {
public String sn;// 不排除本地没有缓存订单号的情况
public String orderNo;
public int orderDispatchType;
public OCHTaxiOrderStatus( String sn,
String orderNo,
int orderDispatchType ) {
this.sn = sn;
this.orderNo = orderNo;
this.orderDispatchType = orderDispatchType;
}
}

View File

@@ -0,0 +1,40 @@
package com.mogo.och.taxi;
public
/**
* @author congtaowang
* @since 2021/1/15
*
* 描述
*/
class OCHTaxiOrderStatusResponse {
// 订单号
public String orderNo;
// 订单运营类型 9出租车10小巴
public int orderType;
// 起始站名称
public String startStation;
public String startStationId;
// 目的站名称
public String endStation;
public String endStationId;
// 当前订单状态
/**
* 未派单 0
* 去往上车站点 1
* 已到达上车站点 2
* 去往下车站点 3
* 到达下车站点 4
* 已完成 5
* 已取消 6
*/
public int orderDispatchType;
// 起始站目的站距离km
public double travelDistance;
}

View File

@@ -0,0 +1,72 @@
package com.mogo.och.taxi;
import android.content.Context;
import com.mogo.map.MogoLatLng;
import com.mogo.map.location.MogoLocation;
import com.mogo.map.overlay.IMogoOverlayManager;
import com.mogo.map.overlay.IMogoPolyline;
import com.mogo.map.overlay.MogoPolylineOptions;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.utils.LocationUtils;
import com.mogo.utils.ColorUtils;
import java.util.ArrayList;
import java.util.List;
public class OCHTaxiOverlayManager {
private IMogoPolyline mMoGoPolyline;
// 连接线参数
private MogoPolylineOptions mPolylineOptions;
// 线路径集合
private List<MogoLatLng> mPolylinePointList;
// 渐变色
private List<Integer> mPolylineColors;
private Context mContext;
IMogoOverlayManager mogoOverlayManager;
public OCHTaxiOverlayManager(Context context) {
mPolylineOptions = new MogoPolylineOptions();
// 绘制路径集合
mPolylinePointList = new ArrayList<>();
// 引导线颜色
mPolylineColors = new ArrayList<>();
mContext = context;
mogoOverlayManager = MogoApisHandler.getInstance().getApis().getMapServiceApi().getOverlayManager(mContext);
}
/**
* 绘制最优路线
*
* @param polylinePoint 要绘制的经纬度度集合
*/
public IMogoPolyline draw(MogoLocation carLocal, List<MogoLatLng> polylinePoint) {
if (mMoGoPolyline != null) {
mMoGoPolyline.remove();
mPolylinePointList.clear();
mPolylineColors.clear();
}
if (polylinePoint != null) {
// 将当前车辆位置放进去
mPolylinePointList.add(new MogoLatLng(carLocal.getLatitude(), carLocal.getLongitude()));
// 过滤后台推送的推荐路线集合
for (MogoLatLng polyline : polylinePoint) {
//需要剔除已经行驶过的经纬度,这里需要比对推荐路线集合中的点是否在当前车辆行驶方向前面如果不在则抛弃
if (LocationUtils.isPointOnCarFront(carLocal, polyline)) {
mPolylinePointList.add(polyline);
}
}
mPolylineColors.addAll(ColorUtils.getGradientAlpha("#002965ED", "#FF2965ED", "#002965ED", mPolylinePointList.size()));
// 替换路径集合
mPolylineOptions.points(mPolylinePointList);
// 线条粗细,渐变,渐变色值
mPolylineOptions.width(25).useGradient(true).colorValues(mPolylineColors);
// 绘制线
mMoGoPolyline = mogoOverlayManager.addPolyline(mPolylineOptions);
}
return mMoGoPolyline;
}
}

View File

@@ -0,0 +1,51 @@
package com.mogo.och.taxi;
import com.mogo.commons.data.BaseData;
import io.reactivex.Observable;
import retrofit2.http.Body;
import retrofit2.http.Headers;
import retrofit2.http.POST;
public
/**
* @author congtaowang
* @since 2021/1/15
*
* 网约车-出租车接口
*/
interface OCHTaxiServiceApi {
/**
* 更新订单状态
*
* @param status
* @return
*/
@Headers( {"Content-type:application/json;charset=UTF-8"} )
@POST( "/yycp-onlinecar-hailing/onlineCarHailing/order/updateOCHOrderState/v1" )
Observable< BaseData > updateOrderStatus( @Body OCHTaxiOrderStatus status );
/**
* 查询订单状态
*
* @return
*/
@Headers( {"Content-type:application/json;charset=UTF-8"} )
@POST( "/yycp-onlinecar-hailing/onlineCarHailing/order/queryOrderForCar/v1" )
Observable< OCHTaxiOrderResponse2 > queryOrder( @Body OCHTaxiOrderStatus status );
/**
* 查询网约车状态
*/
@Headers({"Content-type:application/json;charset=UTF-8"})
@POST("/yycp-onlinecar-hailing/onlineCarHailing/order/queryTaxiCarStatus/v1")
Observable<OCHCarStatusResponse> queryCarStatus(@Body OCHCarStatus sn );
/**
* 更新网约车状态
*/
@Headers({"Content-type:application/json;charset=UTF-8"})
@POST("/yycp-onlinecar-hailing/onlineCarHailing/order/updateTaxiCarStatus/v1")
Observable<OCHCarStatusResponse> updateCarStatus(@Body OCHCarStatus status );
}

View File

@@ -0,0 +1,546 @@
package com.mogo.och.taxi.ui;
import android.location.Location;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import androidx.annotation.NonNull;
import com.mogo.cloud.commons.utils.CoordinateUtils;
import com.mogo.map.MogoLatLng;
import com.mogo.map.location.MogoLocation;
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
import com.mogo.map.overlay.MogoPolylineOptions;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.utils.LocationUtils;
import com.mogo.och.BaseOchFragment;
import com.mogo.och.taxi.IMogoADASAutoPilotStatusChangedListener;
import com.mogo.och.taxi.IMogoOCHTaxiArriveCallback;
import com.mogo.och.taxi.IOperationChangedListener;
import com.mogo.och.taxi.MogoOCHTaxiModel;
import com.mogo.och.taxi.OCHOrderStatus;
import com.mogo.och.taxi.OCHOrderStatusCallback;
import com.mogo.och.taxi.OCHTaxiOverlayManager;
import com.mogo.och.taxi.R;
import com.mogo.och.view.SlidePanelView;
import com.mogo.service.adas.IMogoAdasOCHCallback;
import com.mogo.service.adas.IMogoAdasRouteCallBack;
import com.mogo.service.adas.entity.AdasOCHData;
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
import com.mogo.service.statusmanager.StatusDescriptor;
import com.mogo.utils.logger.Logger;
import java.util.ArrayList;
import java.util.List;
public
/**
* @author congtaowang
* @since 2021/1/18
*
* 网约车-出租车UI
*/
class OCHTaxiFragment extends BaseOchFragment< OCHTaxiView, OCHTaxiPresenter > implements OCHTaxiView,
IMogoStatusChangedListener,
IMogoOCHTaxiArriveCallback,
IMogoADASAutoPilotStatusChangedListener,
IOperationChangedListener,
IMogoAdasRouteCallBack,
IMogoAdasOCHCallback,
IMogoCarLocationChangedListener2 {
public static final String TAG = "OCHTaxiFragment";
public static OCHTaxiFragment newInstance() {
Bundle args = new Bundle();
OCHTaxiFragment fragment = new OCHTaxiFragment();
fragment.setArguments( args );
return fragment;
}
private TextView mOrderStatus;
private TextView mStartStationName;
private TextView mEndStationName;
private TextView mDistance;
private MogoPolylineOptions mogoPolylineOptions;
private volatile int saveOrderState = -1;
@Override
public int getStationPanelViewId() {
return R.layout.module_och_taxi_panel;
}
@Override
public void restartAutopilot() {
// 在自动驾驶中,才会有重新开启自动驾驶的操作
if ( MogoOCHTaxiModel.getInstance().isOnTheWay2EndStation() ) {
Logger.d( TAG, "restartAutopilot" );
MogoOCHTaxiModel.getInstance().startAutoPilot();
}
}
@Override
protected void initViews() {
super.initViews();
mOrderStatus = findViewById( R.id.module_och_taxi_order_status );
mStartStationName = findViewById( R.id.module_och_taxi_order_start_station );
mEndStationName = findViewById( R.id.module_och_taxi_order_end_station );
mDistance = findViewById( R.id.module_och_taxi_order_distance );
// showPanel();
hidPanel();
initListeners();
// updateOrderStatus();
if ( MogoApisHandler.getInstance()
.getApis()
.getStatusManagerApi()
.isVrMode() ) {
vrMode();
} else {
flatMode();
}
tvOperationStatus.setVisibility(View.VISIBLE);
}
private void initListeners() {
MogoApisHandler.getInstance()
.getApis()
.getStatusManagerApi()
.registerStatusChangedListener( TAG, StatusDescriptor.VR_MODE, this );
OCHTaxiUiController.getInstance().setOCHTaxiArriveCallback( this );
OCHTaxiUiController.getInstance().setAutoPilotStatusChangedListener( this );
OCHTaxiUiController.getInstance().setOperationChangeListener(this);
MogoApisHandler.getInstance()
.getApis()
.getRegisterCenterApi()
.registerCarLocationChangedListener( TAG, this );
MogoApisHandler.getInstance().getApis().getAdasControllerApi().addAdasAutopilotRouteCallBack(this);
}
@NonNull
@Override
protected OCHTaxiPresenter createPresenter() {
return new OCHTaxiPresenter( this );
}
@Override
public void onStatusChanged( StatusDescriptor descriptor, boolean isTrue ) {
if ( isTrue ) {
vrMode();
} else {
flatMode();
}
}
@Override
protected void onChangeOperationStatus() {
super.onChangeOperationStatus();
MogoOCHTaxiModel.getInstance().changedOperationStatus();
}
private void vrMode() {
if ( mRootView != null ) {
mRootView.setVisibility(
View.VISIBLE
);
}
}
private void flatMode() {
if ( mRootView != null ) {
mRootView.setVisibility(
View.GONE
);
}
}
private boolean isSpeakedEndingNotice = false;
/**
* 初始化订单信息
*/
private void updateOrderStatus() {
updateOrderBaseStatusInfo();
if ( MogoOCHTaxiModel.getInstance().isArriveAtEndStation() ) {
Logger.d( TAG, "已经达到终点" );
slidePanelView.setVisibility( View.VISIBLE );
slidePanelView.setText( getString( R.string.module_och_taxi_arrive_at_end_station ) );
mOrderStatus.setText( R.string.module_och_taxi_arrive_at_end_station2 );
} else if ( MogoOCHTaxiModel.getInstance().isOnTheWay2EndStation() ) {
Logger.d( TAG, "已经去往终点" );
slidePanelView.setVisibility( View.GONE );
mOrderStatus.setText( R.string.module_och_taxi_on_the_way_2_end_station );
} else if ( MogoOCHTaxiModel.getInstance().isArriveAtStartStation() ) {
Logger.d( TAG, "已经达到起点" );
mOrderStatus.setText( R.string.module_och_taxi_waiting );
slidePanelView.setVisibility( View.VISIBLE );
slidePanelView.setText( getString( R.string.module_och_taxi_arrive_at_start_station ) );
} else if ( MogoOCHTaxiModel.getInstance().checkCurrentOCHOrder() ) {
Logger.d( TAG, "去往上车站点" );
slidePanelView.setVisibility( View.GONE );
mOrderStatus.setText( R.string.module_och_taxi_new_order );
}
}
public synchronized void SpeakNoticeOnce(){
if (!isSpeakedEndingNotice){
isSpeakedEndingNotice = true;
showNotice( getString( R.string.module_och_taxi_order_complete_1) );
}
}
/**
* 更新订单基本信息
*/
private void updateOrderBaseStatusInfo() {
if ( MogoOCHTaxiModel.getInstance().checkCurrentOCHOrder() ) {
mStartStationName.setText( MogoOCHTaxiModel.getInstance().getCurrentOCHOrder().startStation );
mEndStationName.setText( MogoOCHTaxiModel.getInstance().getCurrentOCHOrder().endStation );
double distance = MogoOCHTaxiModel.getInstance().getCurrentOCHOrder().travelDistance;
if ( MogoOCHTaxiModel.getInstance().isArriveAtEndStation() ) {
distance = 0;
}
if ( distance * 1000 >= 1000 ) {
mDistance.setText( String.format( "%.1f km", distance ) );
} else {
mDistance.setText( ( ( int ) ( distance * 1000 ) ) + " m" );
}
}
}
@Override
public void onArriveAtStartStation() {
Logger.d( TAG, "通知达到起点" );
updateOrderStatus();
}
@Override
public void onTheWay2StartStation() {
Logger.d( TAG, "去往上车站点" );
updateOrderStatus();
}
@Override
public void onArriveAtEndStation() {
Logger.d( TAG, "通知达到终点" );
updateOrderStatus();
MogoOCHTaxiModel.getInstance().updateOCHOrderStatus( OCHOrderStatus.ArriveAtEndStation, new OCHOrderStatusCallback() {
@Override
public void onSuccess( Object data ) {
Logger.d( TAG, "更新状态成功" );
onOrderStatusChanged(OCHOrderStatus.ArriveAtEndStation.getCode());
}
@Override
public void onFail() {
Logger.d( TAG, "更新状态失败" );
}
@Override
public void onError() {
Logger.d( TAG, "更新状态失败2" );
}
} );
// MogoApisHandler.getInstance()
// .getApis()
// .getRegisterCenterApi()
// .unregisterCarLocationChangedListener( TAG, this );
}
@Override
public void onTheWay2EndStation() {
Logger.d( TAG, "通知去往终点" );
updateOrderStatus();
}
@Override
public void onUserArriveAtStartStation() {
Logger.d( TAG, "通知乘客已上车" );
updateOrderStatus();
}
@Override
public void onDestroyView() {
super.onDestroyView();
MogoApisHandler.getInstance()
.getApis()
.getStatusManagerApi()
.unregisterStatusChangedListener( TAG, StatusDescriptor.VR_MODE, this );
OCHTaxiUiController.getInstance().setOCHTaxiArriveCallback( null );
OCHTaxiUiController.getInstance().setAutoPilotStatusChangedListener( null );
OCHTaxiUiController.getInstance().setOperationChangeListener(null);
MogoApisHandler.getInstance()
.getApis()
.getRegisterCenterApi()
.unregisterCarLocationChangedListener( TAG, this );
MogoOCHTaxiModel.getInstance().unregisterCarLocationListener();
MogoOCHTaxiModel.getInstance().unregisterSocketListener();
mLocation = null;
}
@Override
public SlidePanelView.OnSlidePanelMoveToEndListener getSlidePanelOnEndListener() {
return this::onSlidePanelMoveToEnd;
}
private void onSlidePanelMoveToEnd() {
// 已到达终点,需要结束订单
if ( MogoOCHTaxiModel.getInstance().isArriveAtEndStation() ) {
MogoOCHTaxiModel.getInstance().updateOCHOrderStatus( OCHOrderStatus.JourneyCompleted, new OCHOrderStatusCallback() {
@Override
public void onSuccess( Object data ) {
Logger.d( TAG, "更新状态成功" );
MogoOCHTaxiModel.getInstance().clearCurrentOCHOrder();
MogoOCHTaxiModel.getInstance().cancelAutopilot();
OCHTaxiUiController.getInstance().onOrderStatusChanged(0);
}
@Override
public void onFail() {
Logger.d( TAG, "更新状态失败" );
}
@Override
public void onError() {
Logger.d( TAG, "更新状态失败2" );
}
} );
return;
// 乘客已确认到达起点,前往下一站并开启自动驾驶
} else if ( !MogoOCHTaxiModel.getInstance().isOnTheWay2EndStation() ) {
MogoOCHTaxiModel.getInstance().startAutoPilot();
}
}
@Override
public void onAutoPilotStatusChanged( int status, String reason ) {
Logger.d( TAG, "status = %s, reason = %s", status, reason );
onAutopilotStatusChanged( status == IMogoAdasOCHCallback.STATUS_AUTOPILOT_RUNNING );
if ( status == IMogoAdasOCHCallback.STATUS_AUTOPILOT_RUNNING && !MogoOCHTaxiModel.getInstance().isArriveAtEndStation()) {
resetOCHTaxiOrderAutopilotStatus();
} else {
updateOrderStatus();
}
}
/**
* 收到自动驾驶通知的成功状态之后,设置本地状态及服务端状态
*/
private void resetOCHTaxiOrderAutopilotStatus() {
MogoOCHTaxiModel.getInstance().setOnTheWay2EndStation( true );
MogoOCHTaxiModel.getInstance().updateOCHOrderStatus( OCHOrderStatus.OnTheWayToEndStation, new OCHOrderStatusCallback() {
@Override
public void onSuccess( Object data ) {
Logger.d( TAG, "更新状态成功" );
onOrderStatusChanged(OCHOrderStatus.OnTheWayToEndStation.getCode());
}
@Override
public void onFail() {
Logger.d( TAG, "更新状态失败" );
}
@Override
public void onError() {
Logger.d( TAG, "更新状态失败2" );
}
} );
}
@Override
public void onCarLocationChanged( MogoLatLng latLng ) {
}
private Location mLocation;
private MogoLocation mogoLocation;
@Override
public void onCarLocationChanged2( Location location ) {
OCHTaxiUiController.getInstance().runOnUIThread( () -> {
calculateTravelDistance( location );
} );
// //坐标转换
// MogoLocation loc = new MogoLocation();
// loc.setTime(loc.getTime());
// loc.setAccuracy(location.getAccuracy());
// loc.setSpeed(location.getSpeed());
// loc.setLongitude(location.getLongitude());
// loc.setLatitude(location.getLatitude());
// loc.setAltitude(location.getAltitude());
// loc.setBearing(location.getBearing());
// loc.setProvider(location.getProvider());
// mogoLocation = loc;
}
/**
* 根据位置信息计算当前剩余距离
*
* @param location
*/
private void calculateTravelDistance( Location location ) {
if ( location == null ) {
return;
}
// if ( !MogoOCHTaxiModel.getInstance().isOnTheWay2EndStation() ) {
// return;
// }
// if ( MogoOCHTaxiModel.getInstance().isArriveAtEndStation() ) {
// return;
// }
if ( mLocation == null ) {
mLocation = location;
}
// double distance = CoordinateUtils.calculateLineDistance(
// location.getLongitude(), location.getLatitude(),
// mLocation.getLongitude(), mLocation.getLatitude()
// );
// Logger.e("lianglihui","calculateTravelDistance:"+distance);
if ( MogoOCHTaxiModel.getInstance().isOnTheWay2EndStation() &&
MogoOCHTaxiModel.getInstance().checkCurrentOCHOrder() &&
!MogoOCHTaxiModel.getInstance().isArriveAtEndStation()) {
MogoOCHTaxiModel.getInstance().calculateTravelDistance(location);
// MogoOCHTaxiModel.getInstance().getCurrentOCHOrder().decreaseTravelDistance( distance );
updateOrderBaseStatusInfo();
}
mLocation = location;
}
@Override
public void onOperationChanged(boolean launch) {
Logger.e(TAG,"onOperationChanged:"+ launch);
isOperationStatus = launch;
if ( launch ) {
tvOperationStatus.setText( "收车" );
// showSlidePanle("滑动出发");
// showPanel();
} else {
// AIAssist.getInstance(getContext()).speakTTSVoice("已收车");
tvOperationStatus.setText("出车");
hideSlidePanel();
// hidPanel();
}
// changeLayoutViewStatus(launch);
}
private void changeLayoutViewStatus(boolean launch) {
getPanelView().setVisibility(launch ? View.VISIBLE : View.INVISIBLE);
}
@Override
public void onOrderStatusChanged(int status) {
// int orderState = MogoOCHTaxiModel.getInstance().getCurrentOCHOrder().orderDispatchType;
// if (orderState == status){
// return;
// }
getActivity().runOnUiThread(() -> {
if (status == OCHOrderStatus.None.getCode() || status == OCHOrderStatus.Cancel.getCode() || status == OCHOrderStatus.JourneyCompleted.getCode() ){
getPanelView().setVisibility(View.INVISIBLE);
hideSlidePanel();
changeOperationViewVisible(View.VISIBLE);
isSpeakedEndingNotice = false;
} else {
getPanelView().setVisibility(View.VISIBLE);
changeOperationViewVisible(View.INVISIBLE);
}
if(status != saveOrderState){
OCHOrderStatus ochStatus = OCHOrderStatus.valueOf( status );
switch (ochStatus){
case OnTheWayToStartStation:
showNotice(getString( R.string.module_och_taxi_new_order));
break;
case Cancel:
showNotice(getString( R.string.module_och_taxi_order_cancel));
break;
case ArriveAtStartStation:
showNotice( getString( R.string.module_och_taxi_order_status_ph_text) );
break;
case OnTheWayToEndStation:
// showNotice("欢迎使用蘑菇智行");
break;
case ArriveAtEndStation:
showNotice( getString( R.string.module_och_taxi_order_complete_1) );
break;
case JourneyCompleted:
showNotice( "感谢您使用蘑菇智行,再见~" );
break;
}
}
saveOrderState = status;
updateOrderStatus();
});
}
private OCHTaxiOverlayManager ochTaxiOverlayManager;
@Override
public void routeResult(List<MogoLatLng> routeList) {
if (routeList == null ) return;
// double distance = calculateTravelDistance(mogoLocation,routeList);
// if ( MogoOCHTaxiModel.getInstance().checkCurrentOCHOrder() ) {
// MogoOCHTaxiModel.getInstance().getCurrentOCHOrder().decreaseTravelDistance( distance );
// updateOrderBaseStatusInfo();
// }
// Logger.d("lianglihui","routeResult 剩余导航距离:"+distance);
// if (routeList != null && routeList.size() >0){
// Logger.d("lianglihui","routeResult:"+routeList.size());
// //adas回调导航路径 绘制引导线
// if ( ochTaxiOverlayManager == null){
// ochTaxiOverlayManager = new OCHTaxiOverlayManager(this.getContext());
// }
// ochTaxiOverlayManager.draw(mogoLocation,routeList);
// }
}
public double calculateTravelDistance(MogoLocation carLocation,List<MogoLatLng> routeList){
List<MogoLatLng> mPolylinePointList = new ArrayList<>();
mPolylinePointList.add(new MogoLatLng(carLocation.getLatitude(), carLocation.getLongitude()));
MogoLatLng routeLatLng;
for (int i = 0 ; i< routeList.size() ; i++) {
routeLatLng =routeList.get(i);
//需要剔除已经行驶过的经纬度这里需要比对推荐路线集合中点是否在当前车w辆行驶方向前面如果不在则抛弃
if (LocationUtils.isPointOnCarFront(carLocation, routeLatLng)) {
mPolylinePointList.add(routeLatLng);
}
}
MogoLatLng routeLatLng1,routeLatLng2;
double distance = 0;
for (int i = 0; i < mPolylinePointList.size() ; i ++){
if (i < mPolylinePointList.size() -1 ){
routeLatLng1 = mPolylinePointList.get(i);
routeLatLng2 = mPolylinePointList.get(i+1);
distance += CoordinateUtils.calculateLineDistance(
routeLatLng1.getLon(), routeLatLng1.getLat(),
routeLatLng2.getLon(), routeLatLng2.getLat()
);
}
}
return distance;
}
@Override
public void onArriveAt(AdasOCHData data) {
Logger.d( TAG, "行程结束");
MogoApisHandler.getInstance().getApis().getAdasControllerApi().cancelAutopilot();
}
@Override
public void onStateChanged(int state, String reason) {
Logger.d( TAG, "onStateChange: " + state );
switch ( state ) {
case IMogoAdasOCHCallback.STATUS_AUTOPILOT_ENABLE:
hideSlidePanel();
break;
case IMogoAdasOCHCallback.STATUS_AUTOPILOT_RUNNING:
break;
default:
break;
}
}
}

View File

@@ -0,0 +1,34 @@
package com.mogo.och.taxi.ui;
import androidx.annotation.NonNull;
import androidx.lifecycle.LifecycleOwner;
import com.mogo.commons.mvp.Presenter;
import com.mogo.utils.logger.Logger;
public
/**
* @author congtaowang
* @since 2021/1/18
*
* 描述
*/
class OCHTaxiPresenter extends Presenter< OCHTaxiView > {
private static final String TAG = "OCHTaxiPresenter";
public OCHTaxiPresenter( OCHTaxiView view ) {
super( view );
}
@Override
public void onCreate( @NonNull LifecycleOwner owner ) {
super.onCreate( owner );
Logger.d( TAG, "网约车-出租车拿到订单" );
}
@Override
public void onDestroy( @NonNull LifecycleOwner owner ) {
super.onDestroy( owner );
}
}

View File

@@ -0,0 +1,204 @@
package com.mogo.och.taxi.ui;
import android.os.Looper;
import android.util.Log;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.och.taxi.IMogoADASAutoPilotStatusChangedListener;
import com.mogo.och.taxi.IMogoOCHTaxiArriveCallback;
import com.mogo.och.taxi.IOperationChangedListener;
import com.mogo.och.taxi.MogoOCHTaxiModel;
import com.mogo.utils.UiThreadHandler;
import com.mogo.utils.logger.Logger;
public
/**
* @author congtaowang
* @since 2021/1/18
*
* 控制UI显示
*/
class OCHTaxiUiController implements IMogoOCHTaxiArriveCallback, IMogoADASAutoPilotStatusChangedListener {
private static final String TAG = "OCHTaxiUiController";
private static volatile OCHTaxiUiController sInstance;
private FragmentActivity mActivity;
private int mContainerId;
private IMogoOCHTaxiArriveCallback mOCHTaxiArriveCallback;
private IMogoADASAutoPilotStatusChangedListener mAutoPilotStatusChangedListener;
private IOperationChangedListener mOperationChangedLisnter;
private OCHTaxiUiController() {
}
public static OCHTaxiUiController getInstance() {
if ( sInstance == null ) {
synchronized ( OCHTaxiUiController.class ) {
if ( sInstance == null ) {
sInstance = new OCHTaxiUiController();
}
}
}
return sInstance;
}
private Object readResolve() {
// 阻止反序列化,必须实现 Serializable 接口
return sInstance;
}
public void init( FragmentActivity activity, int containerId ) {
mActivity = activity;
mContainerId = containerId;
}
public void addFragment() {
Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
runOnUIThread( this::addFragmentImpl );
}
private void addFragmentImpl() {
if ( !MogoOCHTaxiModel.getInstance().checkCurrentOCHOrder() ) {
return;
}
Fragment fragment = null;
FragmentManager fragmentManager = mActivity.getSupportFragmentManager();
fragment = fragmentManager.findFragmentByTag( OCHTaxiFragment.TAG );
if ( fragment == null ) {
fragment = OCHTaxiFragment.newInstance();
}
mActivity.getSupportFragmentManager()
.beginTransaction()
.replace( mContainerId, fragment, OCHTaxiFragment.TAG )
.commitNowAllowingStateLoss();
Logger.d( TAG, "add fragment" );
}
public void removeFragment() {
runOnUIThread( () -> {
Fragment fragment = null;
FragmentManager fragmentManager = mActivity.getSupportFragmentManager();
fragment = fragmentManager.findFragmentByTag( OCHTaxiFragment.TAG );
if ( fragment == null ) {
return;
}
fragmentManager.beginTransaction()
.remove( fragment )
.commitNowAllowingStateLoss();
} );
}
public void setOCHTaxiArriveCallback( IMogoOCHTaxiArriveCallback OCHTaxiArriveCallback ) {
this.mOCHTaxiArriveCallback = OCHTaxiArriveCallback;
}
public void setAutoPilotStatusChangedListener( IMogoADASAutoPilotStatusChangedListener autoPilotStatusChangedListener ) {
this.mAutoPilotStatusChangedListener = autoPilotStatusChangedListener;
}
public void setOperationChangeListener(IOperationChangedListener listener){
this.mOperationChangedLisnter = listener;
}
@Override
public void onTheWay2StartStation() {
runOnUIThread( () -> {
if ( mOCHTaxiArriveCallback != null ) {
mOCHTaxiArriveCallback.onTheWay2StartStation();
}
} );
}
@Override
public void onArriveAtStartStation() {
runOnUIThread( () -> {
if ( mOCHTaxiArriveCallback != null ) {
mOCHTaxiArriveCallback.onArriveAtStartStation();
}
} );
}
@Override
public void onTheWay2EndStation() {
runOnUIThread( () -> {
if ( mOCHTaxiArriveCallback != null ) {
mOCHTaxiArriveCallback.onTheWay2EndStation();
}
} );
}
@Override
public void onArriveAtEndStation() {
runOnUIThread( () -> {
if ( mOCHTaxiArriveCallback != null ) {
mOCHTaxiArriveCallback.onArriveAtEndStation();
}
} );
}
@Override
public void onUserArriveAtStartStation() {
runOnUIThread( () -> {
if ( mOCHTaxiArriveCallback != null ) {
mOCHTaxiArriveCallback.onUserArriveAtStartStation();
}
} );
}
public void runOnUIThread( Runnable executor ) {
if ( executor == null ) {
return;
}
if ( Looper.myLooper() != Looper.getMainLooper() ) {
UiThreadHandler.post( executor );
} else {
executor.run();
}
}
@Override
public void onAutoPilotStatusChanged( int status, String reason ) {
runOnUIThread( () -> {
if ( mAutoPilotStatusChangedListener != null ) {
mAutoPilotStatusChangedListener.onAutoPilotStatusChanged( status, reason );
}
} );
}
/**
* 进入鹰眼模式,设置手势缩放地图失效
*/
public void stepIntoVrMode() {
Logger.d( TAG, "进入vr模式" );
MogoApisHandler.getInstance()
.getApis()
.getMapServiceApi()
.getMapUIController()
.openVrMode( false );
}
public void onOperationChanged(boolean b) {
runOnUIThread( () -> {
if (mOperationChangedLisnter != null){
mOperationChangedLisnter.onOperationChanged(b);
}
} );
}
public void onOrderStatusChanged(int status){
runOnUIThread( () -> {
if (mOperationChangedLisnter != null){
mOperationChangedLisnter.onOrderStatusChanged(status);
}
} );
}
}

View File

@@ -0,0 +1,13 @@
package com.mogo.och.taxi.ui;
import com.mogo.commons.mvp.IView;
public
/**
* @author congtaowang
* @since 2021/1/18
*
* 描述
*/
interface OCHTaxiView extends IView {
}

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<corners android:radius="17px" />
<gradient
android:angle="270"
android:endColor="#3B4577"
android:startColor="#3B4577" />
</shape>
</item>
<item
android:bottom="3px"
android:left="3px"
android:right="3px"
android:top="3px">
<shape>
<corners android:radius="17px" />
<gradient
android:angle="270"
android:endColor="#3B4577"
android:startColor="#3B4577" />
</shape>
</item>
</layer-list>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="0"
android:centerColor="#80222A4E"
android:endColor="#80222A4E"
android:startColor="#80222A4E" />
<corners
android:bottomLeftRadius="17px"
android:bottomRightRadius="17px"
android:topLeftRadius="0px"
android:topRightRadius="0px" />
</shape>

View File

@@ -0,0 +1,166 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/module_och_taxi_layoutview"
android:layout_width="@dimen/module_mogo_och_autopilot_order_bg_width"
android:layout_height="@dimen/module_mogo_och_autopilot_order_bg_height"
android:orientation="vertical">
<TextView
android:id="@+id/module_och_taxi_order_status"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/module_och_taxi_order_status_marginLeft"
android:layout_marginTop="@dimen/module_och_taxi_order_status_marginTop"
android:text="@string/module_och_taxi_order_status_ph_text"
android:textColor="@color/module_och_order_status_textColor"
android:textSize="@dimen/module_och_taxi_order_status_textSize"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:id="@+id/module_och_taxi_order_status_divider"
android:layout_width="0dp"
android:layout_height="@dimen/module_och_taxi_order_status_divider_height"
android:layout_marginLeft="@dimen/module_och_taxi_order_status_divider_marginLeft"
android:layout_marginTop="@dimen/module_och_taxi_order_status_divider_marginTop"
android:layout_marginRight="@dimen/module_och_taxi_order_status_divider_marginRight"
android:background="@color/module_och_taxi_order_status_divider_bkgColor"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/module_och_taxi_order_status" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/module_och_taxi_order_status_stationInfo"
android:layout_width="match_parent"
android:layout_height="0dp"
android:paddingLeft="@dimen/module_och_taxi_order_status_stationInfo_paddingLeft"
android:paddingTop="@dimen/module_och_taxi_order_status_stationInfo_paddingTop"
android:paddingRight="@dimen/module_och_taxi_order_status_stationInfo_paddingRight"
android:paddingBottom="@dimen/module_och_taxi_order_status_stationInfo_paddingBottom"
app:layout_constraintBottom_toTopOf="@+id/module_och_taxi_order_distance_container"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/module_och_taxi_order_status_divider">
<ImageView
android:id="@+id/greenDot"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/module_mogo_och_icon_arriving_station"
app:layout_constraintBottom_toBottomOf="@+id/module_och_taxi_order_start_station"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="@+id/module_och_taxi_order_start_station" />
<TextView
android:id="@+id/module_och_taxi_order_start_station"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/module_och_taxi_order_start_station_marginLeft"
android:textColor="@color/module_och_order_status_textColor"
android:textSize="@dimen/module_och_taxi_order_start_station_textSize"
android:textStyle="bold"
app:layout_constraintLeft_toRightOf="@+id/greenDot"
app:layout_constraintTop_toTopOf="parent"
tools:text="后路站" />
<TextView
android:id="@+id/module_och_taxi_order_start_station_anchor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="上车"
android:textColor="@color/module_och_taxi_order_start_station_anchor_textColor"
android:layout_marginRight="@dimen/module_och_taxi_order_text_marginRight"
android:textSize="@dimen/module_och_taxi_order_start_station_anchor_textSize"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@+id/module_och_taxi_order_start_station"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@+id/module_och_taxi_order_start_station" />
<ImageView
android:id="@+id/dotLine"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:scaleType="fitXY"
android:src="@drawable/module_och_dot_line"
app:layout_constraintBottom_toTopOf="@+id/blueDot"
app:layout_constraintLeft_toLeftOf="@+id/greenDot"
app:layout_constraintRight_toRightOf="@+id/greenDot"
app:layout_constraintTop_toBottomOf="@+id/greenDot" />
<ImageView
android:id="@+id/blueDot"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/module_mogo_och_icon_arrived_station"
app:layout_constraintBottom_toBottomOf="@+id/module_och_taxi_order_end_station"
app:layout_constraintLeft_toLeftOf="@+id/greenDot"
app:layout_constraintTop_toTopOf="@+id/module_och_taxi_order_end_station" />
<TextView
android:id="@+id/module_och_taxi_order_end_station"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/module_och_order_status_textColor"
android:textSize="@dimen/module_och_taxi_order_start_station_textSize"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="@+id/module_och_taxi_order_start_station"
app:layout_constraintLeft_toRightOf="@+id/greenDot"
tools:text="后路站1" />
<TextView
android:id="@+id/module_och_taxi_order_end_station_anchor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="下车"
android:layout_marginRight="@dimen/module_och_taxi_order_text_marginRight"
android:textColor="@color/module_och_taxi_order_end_station_anchor_textColor"
android:textSize="@dimen/module_och_taxi_order_end_station_anchor_textSize"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@+id/module_och_taxi_order_end_station"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@+id/module_och_taxi_order_end_station" />
</androidx.constraintlayout.widget.ConstraintLayout>
<FrameLayout
android:id="@+id/module_och_taxi_order_distance_container"
android:layout_width="match_parent"
android:layout_height="@dimen/module_och_taxi_order_distance_container_height"
android:background="@drawable/module_och_taxi_panel_distance_bkg"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<TextView
android:id="@+id/module_och_taxi_order_distance_anchor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/module_och_taxi_order_distance_anchor_marginLeft"
android:text="@string/module_och_taxi_order_distance_anchor_text"
android:textColor="@color/module_och_taxi_order_distance_anchor_textColor"
android:textSize="@dimen/module_och_taxi_order_distance_anchor_textSize"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@+id/greenDot" />
<TextView
android:id="@+id/module_och_taxi_order_distance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|right"
android:layout_marginRight="@dimen/module_och_taxi_order_distance_marginRight"
android:text="@string/module_och_taxi_order_distance_text_ph"
android:textColor="@color/module_och_taxi_order_distance_textColor"
android:textSize="@dimen/module_och_taxi_order_distance_textSize"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@+id/greenDot" />
</FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,22 @@
{
"drivingRoutes": [
{
"lat": 40.197234,
"lon": 116.74143,
"siteId": "1.0",
"siteName": "万集东门站"
},
{
"lat": 40.1953113732,
"lon": 116.729134342,
"siteId": "2.0",
"siteName": "市政府前街18号"
}
],
"endStation": "市政府前街18号",
"orderDispatchType": 1,
"orderNo": "CZ20210430000005",
"orderType": 9,
"startStation": "万集东门站",
"travelDistance": 0.6
}

View File

@@ -0,0 +1,39 @@
{
"code": 0,
"msg": "",
"detailMsg": "",
"result": {
"_id": "5352c1d2c9d84ab3ab9ecf1e47e13bdd",
"orderNo": "CZ20210427000016",
"orderType": 9,
"userName": "董QAD",
"userPhone": "15631204018",
"startStationId": 10000,
"startStation": "0409第一站",
"startStationCoordinate": [
116.7389159039,
40.1992312592
],
"endStationId": 21,
"endStation": "第二十一站",
"endStationCoordinate": [
116.737866,
40.19646
],
"orderDispatchType": 1,
"carNum": "京NB010",
"sn": "F803EB2046PZD00149",
"orderStartTime": "Apr 27, 2021 8:55:44 PM",
"arrivedStartStationTime": "",
"arrivedEndStationTime": "",
"cityCode": "010",
"areaCode": "1001",
"createTime": "Apr 27, 2021 8:55:44 PM",
"updateTime": "Apr 27, 2021 8:55:56 PM",
"personNum": 1,
"travelDistance": 0.3,
"vehicleColour": "黑色",
"lastBrandName": "",
"headImgUrl": "https://thirdwx.qlogo.cn/mmopen/vi_32/DYAIOgq83ep4YkeZqjiazTK87NQtYp6KMYvAdJcxNpxyJ2gibeNNheH1HFaJdX4hB15eIR3zZdGMWNanKzIn460w/132"
}
}

View File

@@ -0,0 +1,10 @@
{
"endStation": "市政府前街18号",
"endStationId": "2.0",
"orderDispatchType": 7,
"orderNo": "CZ20210430000005",
"orderType": 9,
"startStation": "万集东门站",
"startStationId": "1.0",
"travelDistance": 0.6
}

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="module_och_taxi_panel_width">464px</dimen>
<dimen name="module_och_taxi_panel_height">310px</dimen>
<dimen name="module_och_taxi_order_start_station_marginLeft">15px</dimen>
<dimen name="module_och_taxi_order_status_marginLeft">25px</dimen>
<dimen name="module_och_taxi_order_status_marginTop">25px</dimen>
<dimen name="module_och_taxi_order_status_textSize">32px</dimen>
<dimen name="module_och_taxi_order_status_divider_height">1px</dimen>
<dimen name="module_och_taxi_order_status_divider_marginLeft">20px</dimen>
<dimen name="module_och_taxi_order_status_divider_marginTop">20px</dimen>
<dimen name="module_och_taxi_order_status_divider_marginRight">20px</dimen>
<dimen name="module_och_taxi_order_status_stationInfo_height">140px</dimen>
<dimen name="module_och_taxi_order_status_stationInfo_paddingLeft">20px</dimen>
<dimen name="module_och_taxi_order_status_stationInfo_paddingTop">41px</dimen>
<dimen name="module_och_taxi_order_status_stationInfo_paddingRight">17px</dimen>
<dimen name="module_och_taxi_order_status_stationInfo_paddingBottom">41px</dimen>
<dimen name="module_och_taxi_order_start_station_textSize">42px</dimen>
<dimen name="module_och_taxi_order_start_station_anchor_textSize">32px</dimen>
<dimen name="module_och_taxi_order_end_station_anchor_textSize">32px</dimen>
<dimen name="module_och_taxi_order_distance_container_height">84px</dimen>
<dimen name="module_och_taxi_order_distance_container_marginLeft">3px</dimen>
<dimen name="module_och_taxi_order_distance_anchor_marginLeft">20px</dimen>
<dimen name="module_och_taxi_order_distance_anchor_textSize">32px</dimen>
<dimen name="module_och_taxi_order_distance_textSize">36px</dimen>
<dimen name="module_och_taxi_order_distance_marginRight">17px</dimen>
<dimen name="module_och_taxi_order_text_marginRight">31.5px</dimen>
</resources>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="module_och_order_status_textColor">#FFFFFF</color>
<color name="module_och_taxi_order_status_divider_bkgColor">#707DBE</color>
<color name="module_och_taxi_order_start_station_anchor_textColor">#8198E8</color>
<color name="module_och_taxi_order_end_station_anchor_textColor">#8198E8</color>
<color name="module_och_taxi_order_distance_anchor_textColor">#8198E8</color>
<color name="module_och_taxi_order_distance_textColor">#FFFFFF</color>
</resources>

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="module_och_taxi_panel_width">464px</dimen>
<dimen name="module_och_taxi_panel_height">310px</dimen>
<dimen name="module_och_taxi_order_start_station_marginLeft">5px</dimen>
<dimen name="module_och_taxi_order_status_marginLeft">20px</dimen>
<dimen name="module_och_taxi_order_status_marginTop">20px</dimen>
<dimen name="module_och_taxi_order_status_textSize">20px</dimen>
<dimen name="module_och_taxi_order_status_divider_height">1px</dimen>
<dimen name="module_och_taxi_order_status_divider_marginLeft">20px</dimen>
<dimen name="module_och_taxi_order_status_divider_marginTop">20px</dimen>
<dimen name="module_och_taxi_order_status_divider_marginRight">20px</dimen>
<dimen name="module_och_taxi_order_status_stationInfo_height">140px</dimen>
<dimen name="module_och_taxi_order_status_stationInfo_paddingLeft">20px</dimen>
<dimen name="module_och_taxi_order_status_stationInfo_paddingTop">20px</dimen>
<dimen name="module_och_taxi_order_status_stationInfo_paddingRight">17px</dimen>
<dimen name="module_och_taxi_order_status_stationInfo_paddingBottom">20px</dimen>
<dimen name="module_och_taxi_order_start_station_textSize">26px</dimen>
<dimen name="module_och_taxi_order_start_station_anchor_textSize">20px</dimen>
<dimen name="module_och_taxi_order_end_station_anchor_textSize">20px</dimen>
<dimen name="module_och_taxi_order_distance_container_height">64px</dimen>
<dimen name="module_och_taxi_order_distance_container_marginLeft">3px</dimen>
<dimen name="module_och_taxi_order_distance_anchor_marginLeft">20px</dimen>
<dimen name="module_och_taxi_order_distance_anchor_textSize">20px</dimen>
<dimen name="module_och_taxi_order_distance_textSize">24px</dimen>
<dimen name="module_och_taxi_order_distance_marginRight">17px</dimen>
<dimen name="module_och_taxi_order_text_marginRight">22.5px</dimen>
</resources>

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="module_och_taxi_arrive_at_start_station">确认上车,行程开始</string>
<string name="module_och_taxi_arrive_at_end_station">到达站点,乘客已下车</string>
<string name="module_och_taxi_order_status_ph_text">已到达上车站点,等待乘客上车</string>
<string name="module_och_taxi_order_distance_anchor_text">预计里程</string>
<string name="module_och_taxi_order_distance_text_ph">3.2 km</string>
<string name="module_och_taxi_order_complete">请携带好随身物品,注意侧后\n方来车感谢体验蘑菇智行自\n动驾驶车</string>
<string name="module_och_taxi_order_complete_1">即将到达目的地,请您携带好随身物品,安全下车。</string>
<string name="module_och_taxi_on_the_way_2_end_station">去往下车地点</string>
<string name="module_och_taxi_waiting">已到达,等待乘客上车</string>
<string name="module_och_taxi_new_order">收到新订单,前往上车地点</string>
<string name="module_och_taxi_arrive_at_end_station2">已到达下车地点</string>
<string name="module_och_taxi_order_completed">订单已完成</string>
<string name="module_och_taxi_order_cancel">订单已取消</string>
</resources>

1
OCH/mogo-och/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/build

56
OCH/mogo-och/build.gradle Normal file
View File

@@ -0,0 +1,56 @@
apply plugin: 'com.android.library'
apply plugin: 'com.alibaba.arouter'
android {
compileSdkVersion rootProject.ext.android.compileSdkVersion
// buildToolsVersion rootProject.ext.android.buildToolsVersion
defaultConfig {
minSdkVersion rootProject.ext.android.minSdkVersion
targetSdkVersion rootProject.ext.android.targetSdkVersion
versionCode Integer.valueOf(VERSION_CODE)
versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION")
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
javaCompileOptions {
annotationProcessorOptions {
arguments = [AROUTER_MODULE_NAME: project.getName()]
}
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation rootProject.ext.dependencies.androidxappcompat
implementation rootProject.ext.dependencies.arouter
annotationProcessor rootProject.ext.dependencies.aroutercompiler
implementation rootProject.ext.dependencies.androidxconstraintlayout
if (Boolean.valueOf(RELEASE)) {
implementation rootProject.ext.dependencies.mogoutils
implementation rootProject.ext.dependencies.mogocommons
implementation rootProject.ext.dependencies.modulecommon
} else {
implementation project(":foudations:mogo-utils")
implementation project(":foudations:mogo-commons")
implementation project(":modules:mogo-module-common")
}
}
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()

View File

View File

@@ -0,0 +1,3 @@
GROUP=com.mogo.och
POM_ARTIFACT_ID=och
VERSION_CODE=1

21
OCH/mogo-och/proguard-rules.pro vendored Normal file
View File

@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

View File

@@ -0,0 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mogo.och">
/
</manifest>

Some files were not shown because too many files have changed in this diff Show More