Merge remote-tracking branch 'origin/dev' into dev
# Conflicts: # gradle.properties # libraries/tanlulib/src/main/java/com/zhidao/roadcondition/service/CosStatusController.kt # modules/mogo-module-share/src/main/java/com/mogo/module/share/manager/UploadHelper.kt # modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/SimpleCoverVideoPlayer.kt
This commit is contained in:
@@ -372,6 +372,7 @@ dependencies {
|
||||
apply from: "./functions/crashreport.gradle"
|
||||
apply from: "./functions/widgets.gradle"
|
||||
apply from: "./functions/tts.gradle"
|
||||
|
||||
}
|
||||
|
||||
android.applicationVariants.all { variant ->
|
||||
|
||||
@@ -60,7 +60,7 @@ public class MogoApplication extends AbsMogoApplication {
|
||||
crashSystem.init();
|
||||
//设置debug模式,日志不上传
|
||||
crashSystem.setDebug( BuildConfig.DEBUG );
|
||||
Logger.init( BuildConfig.DEBUG ? LogLevel.DEBUG : LogLevel.OFF );
|
||||
Logger.init( BuildConfig.DEBUG ? LogLevel.VERBOSE : LogLevel.VERBOSE );
|
||||
|
||||
MogoModulePaths.addModule( new MogoModule( PATH_GUIDE_FRAGMENT, PATH_GUIDE_MODULE_NAME ) );
|
||||
MogoModulePaths.addModule( new MogoModule( MogoServicePaths.PATH_AGREEMENT, AuthorizeConstant.PATH_AGREEMENT_MODULE_NAME ) );
|
||||
@@ -78,12 +78,14 @@ public class MogoApplication extends AbsMogoApplication {
|
||||
MogoModulePaths.addBaseModule( new MogoModule( ShareConstants.TAG, ShareConstants.MODEL_NAME ) );
|
||||
MogoModulePaths.addModule( new MogoModule( MogoServicePaths.PATH_TANLU_API, "TanluApi" ) );
|
||||
MogoModulePaths.addModule( new MogoModule( MogoServicePaths.PATH_SHARE, "ShareControl" ) );
|
||||
MogoModulePaths.addModule( new MogoModule( MogoServicePaths.PATH_TRAFFIC_UPLOAD, "TrafficUpload" ) );
|
||||
|
||||
MogoModulePaths.addModule( new MogoModule( LeftPanelConst.PATH_NAME, LeftPanelConst.MODULE_NAME ) );
|
||||
|
||||
MogoModulePaths.addBaseModule( new MogoModule( ServiceConst.PATH_REFRESH_STRATEGY, ServiceConst.PATH_REFRESH_STRATEGY ) );
|
||||
MogoModulePaths.addBaseModule( new MogoModule( V2XConst.PATH_V2X_UI, V2XConst.MODULE_NAME ) );
|
||||
MogoModulePaths.addBaseModule( new MogoModule( MogoServicePaths.PATH_STRATEGY_SHARE, "StrategyShare" ) );
|
||||
MogoModulePaths.addBaseModule( new MogoModule( MogoServicePaths.PATH_GAODE_AIMLESS_SHARE, "GaoDeAimlessShare" ) );
|
||||
MogoModulePaths.addBaseModule( new MogoModule( MogoServicePaths.PATH_EVENT_PANEL, "EventPanel" ) );
|
||||
MogoModulePaths.addBaseModule( new MogoModule( MogoServicePaths.PATH_MOGO_MONITOR, "MogoMonitor" ) );
|
||||
MogoModulePaths.addModule( new MogoModule( PushUIConstants.PATH, PushUIConstants.NAME ) );
|
||||
|
||||
501
foudations/mogo-utils/src/main/java/com/mogo/utils/Dispatch.java
Normal file
501
foudations/mogo-utils/src/main/java/com/mogo/utils/Dispatch.java
Normal file
@@ -0,0 +1,501 @@
|
||||
package com.mogo.utils;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.Objects;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
public final class Dispatch<T> {
|
||||
|
||||
private static final Dispatch<?> EMPTY = new Dispatch<>();
|
||||
|
||||
private final T value;
|
||||
|
||||
public Dispatch() {
|
||||
this.value = null;
|
||||
}
|
||||
|
||||
private Dispatch(T value) {
|
||||
this.value = requireNonNull(value);
|
||||
}
|
||||
|
||||
private static <T> T requireNonNull(T obj) {
|
||||
if (obj == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
private static <T> Dispatch<T> empty() {
|
||||
Dispatch<T> t = (Dispatch<T>) EMPTY;
|
||||
return t;
|
||||
}
|
||||
|
||||
public static <R> Dispatch<R> of(R value) {
|
||||
return new Dispatch<>(value);
|
||||
}
|
||||
|
||||
public static <T> Dispatch<T> ofNullable(T value) {
|
||||
return value == null ? (Dispatch<T>) empty() : of(value);
|
||||
}
|
||||
|
||||
public static <R> DispatchImpl<R> stream(Collection<R> collection) {
|
||||
return new DispatchImpl<>(new ArrayList<>(collection));
|
||||
}
|
||||
|
||||
public static <R> DispatchImpl<R> stream(R... values) {
|
||||
List<R> list = new ArrayList<>();
|
||||
for (R r : values) {
|
||||
list.add(r);
|
||||
}
|
||||
return new DispatchImpl<>(list);
|
||||
}
|
||||
|
||||
public static <T> DispatchImpl<T> iterate(T seed, final Function<T, T> mapper, int maxSize) {
|
||||
List<T> list = new ArrayList<>();
|
||||
list.add(seed);
|
||||
if (maxSize - 1 > 0) {
|
||||
for (int i = 0, len = maxSize - 1; i < len; i++) {
|
||||
list.add(seed = mapper.apply(seed));
|
||||
}
|
||||
}
|
||||
return new DispatchImpl<>(list);
|
||||
}
|
||||
|
||||
public final T get() {
|
||||
if (value == null) {
|
||||
throw new NoSuchElementException("No value present");
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public final boolean isPresent() {
|
||||
return value != null;
|
||||
}
|
||||
|
||||
public final void ifPresent(Consumer<? super T> consumer) {
|
||||
if (value != null) {
|
||||
consumer.accept(value);
|
||||
}
|
||||
}
|
||||
|
||||
public final Dispatch<T> filter(Predicate<? super T> predicate) {
|
||||
requireNonNull(predicate);
|
||||
if (!isPresent()) {
|
||||
return this;
|
||||
} else {
|
||||
return predicate.test(value) ? this : (Dispatch<T>) empty();
|
||||
}
|
||||
}
|
||||
|
||||
public final <U> Dispatch<U> map(Function<? super T, ? extends U> mapper) {
|
||||
requireNonNull(mapper);
|
||||
if (!isPresent()) {
|
||||
return empty();
|
||||
} else {
|
||||
return Dispatch.ofNullable(mapper.apply(value));
|
||||
}
|
||||
}
|
||||
|
||||
public final <U> Dispatch<U> flatMap(Function<? super T, Dispatch<U>> mapper) {
|
||||
requireNonNull(mapper);
|
||||
if (!isPresent()) {
|
||||
return empty();
|
||||
} else {
|
||||
return requireNonNull(mapper.apply(value));
|
||||
}
|
||||
}
|
||||
|
||||
public final T orElse(T other) {
|
||||
return value != null ? value : other;
|
||||
}
|
||||
|
||||
public final T orElseGet(Supplier<? extends T> other) {
|
||||
return value != null ? value : other.get();
|
||||
}
|
||||
|
||||
public final <X extends Throwable> T orElseThrow(Supplier<? extends X> exceptionSupplier) throws X {
|
||||
if (value != null) {
|
||||
return value;
|
||||
} else {
|
||||
throw exceptionSupplier.get();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (!(obj instanceof Dispatch)) {
|
||||
return false;
|
||||
}
|
||||
Dispatch<?> other = (Dispatch<?>) obj;
|
||||
|
||||
return Objects.equals(value, other.value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int hashCode() {
|
||||
return value != null ? value.hashCode() : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final String toString() {
|
||||
return value != null
|
||||
? String.format("Dispatch[%s]", value)
|
||||
: "Dispatch.empty";
|
||||
}
|
||||
|
||||
|
||||
public final static class DispatchImpl<E> {
|
||||
|
||||
private final List<E> value;
|
||||
|
||||
private DispatchImpl() {
|
||||
this.value = null;
|
||||
}
|
||||
|
||||
private DispatchImpl(List<E> value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public final boolean isPresent() {
|
||||
return value != null;
|
||||
}
|
||||
|
||||
public final DispatchImpl<E> filter(Predicate<? super E> predicate) {
|
||||
requireNonNull(predicate);
|
||||
if (isPresent()) {
|
||||
forEach(e -> {
|
||||
if (!predicate.test(e)) {
|
||||
this.value.remove(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public final <R> DispatchImpl<R> map(Function<? super E, ? extends R> mapper) {
|
||||
requireNonNull(mapper);
|
||||
|
||||
List<R> target = new ArrayList<>();
|
||||
if (isPresent()) {
|
||||
for (E e : value) {
|
||||
target.add(mapper.apply(e));
|
||||
}
|
||||
}
|
||||
return new DispatchImpl<>(target);
|
||||
}
|
||||
|
||||
/**
|
||||
* 多个数组数据源转换成一个数组数据源
|
||||
*
|
||||
* @param mapper
|
||||
* @param <R>
|
||||
* @return
|
||||
*/
|
||||
public final <R> DispatchImpl<R> flatMap(Function<? super E, ? extends DispatchImpl<? extends R>> mapper) {
|
||||
requireNonNull(mapper);
|
||||
|
||||
List<R> dispatchStream = new ArrayList<>();
|
||||
if (isPresent()) {
|
||||
this.forEach(e -> {
|
||||
dispatchStream.addAll(((DispatchImpl<R>) mapper.apply(e)).value);
|
||||
});
|
||||
}
|
||||
return new DispatchImpl<>(dispatchStream);
|
||||
}
|
||||
|
||||
public final DispatchImpl<E> distinct() {
|
||||
List<E> target = new ArrayList<>();
|
||||
if (isPresent()) {
|
||||
for (E e : value) {
|
||||
if (!target.contains(e)) {
|
||||
target.add(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public final DispatchImpl<E> forEach(Consumer<? super E> action) {
|
||||
requireNonNull(action);
|
||||
if (isPresent()) {
|
||||
for (E e : value) {
|
||||
action.accept(e);
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public final DispatchImpl<E> forEach(BiConsumer<Integer, E> action) {
|
||||
requireNonNull(action);
|
||||
if (isPresent()) {
|
||||
for (int i = 0, len = value.size(); i < len; i++) {
|
||||
action.accept(i, value.get(i));
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public final DispatchImpl<E> limit(int maxSize) {
|
||||
if (this.isPresent() && maxSize > 0) {
|
||||
return new DispatchImpl<>(this.value.subList(0, maxSize > this.count() ? this.count() : maxSize));
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public final DispatchImpl<E> skip(int n) {
|
||||
if (this.isPresent() && n > 0 && n < count()) {
|
||||
return new DispatchImpl<>(this.value.subList(n, this.count()));
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public final DispatchImpl<E> peek(Consumer<? super E> action) {
|
||||
if (this.isPresent()) {
|
||||
forEach(action);
|
||||
}
|
||||
forEach(action);
|
||||
return this;
|
||||
}
|
||||
|
||||
public final DispatchImpl<E> sorted() {
|
||||
return sorted(Object::hashCode);
|
||||
}
|
||||
|
||||
public final <R extends Comparable<? super R>> DispatchImpl<E> sorted(Function<E, R> function) {
|
||||
requireNonNull(function);
|
||||
return sorted((Comparator<E> & Serializable) (c1, c2) -> function.apply(c1).compareTo(function.apply(c2)));
|
||||
}
|
||||
|
||||
public final DispatchImpl<E> sorted(Comparator<? super E> comparator) {
|
||||
requireNonNull(comparator);
|
||||
if (isPresent()) {
|
||||
Collections.sort(value, comparator);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public final int count() {
|
||||
if (isPresent()) {
|
||||
return value.size();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public final Dispatch<E> findFirst() {
|
||||
if (isPresent() && value.size() > 0) {
|
||||
return Dispatch.ofNullable(value.get(0));
|
||||
}
|
||||
return Dispatch.empty();
|
||||
}
|
||||
|
||||
public final Dispatch<E> findAny() {
|
||||
if (isPresent() && value.size() > 0) {
|
||||
return Dispatch.ofNullable(value.get(new Random().nextInt(value.size())));
|
||||
}
|
||||
return Dispatch.empty();
|
||||
}
|
||||
|
||||
public final Dispatch<E> findAny(Predicate<E> predicate) {
|
||||
if (isPresent() && value.size() > 0) {
|
||||
for (E e : value) {
|
||||
if (predicate.test(e)) {
|
||||
return Dispatch.ofNullable(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
return Dispatch.empty();
|
||||
}
|
||||
|
||||
public final E[] toArray() {
|
||||
if (isPresent()) {
|
||||
return (E[]) this.value.toArray();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 输出需要的数据类型
|
||||
*
|
||||
* @param supplier
|
||||
* @param accumulator
|
||||
* @return
|
||||
*/
|
||||
public final <R> R toCollect(Supplier<R> supplier, BiConsumer<R, ? super E> accumulator) {
|
||||
requireNonNull(supplier);
|
||||
requireNonNull(accumulator);
|
||||
R r = supplier.get();
|
||||
forEach(t -> {
|
||||
accumulator.accept(r, t);
|
||||
});
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
public final <R extends Collection> R toCollection(Supplier<R> supplier) {
|
||||
return toCollect(supplier, Collection::add);
|
||||
}
|
||||
|
||||
public final List<E> toList() {
|
||||
return toCollection((Supplier<List<E>>) ArrayList::new);
|
||||
}
|
||||
|
||||
public final Set<E> toSet() {
|
||||
return toCollection((Supplier<Set<E>>) HashSet::new);
|
||||
}
|
||||
|
||||
|
||||
public final <K, U> Map<K, U> toMap(Function<? super E, ? extends K> keyMapper, Function<? super E, ? extends U> valueMapper, BiFunction<U, U, U> mergeFunction, Supplier<Map<K, U>> mapSupplier) {
|
||||
BiConsumer<Map<K, U>, E> accumulator = (map, element) -> {
|
||||
K key = keyMapper.apply(element);
|
||||
U value = valueMapper.apply(element);
|
||||
|
||||
U oldValue = map.get(key);
|
||||
U newValue = (oldValue == null) ? value : mergeFunction.apply(oldValue, value);
|
||||
if (newValue == null) {
|
||||
map.remove(key);
|
||||
} else {
|
||||
map.put(key, newValue);
|
||||
}
|
||||
};
|
||||
return this.toCollect(HashMap::new, accumulator);
|
||||
}
|
||||
|
||||
public final <K, U> Map<K, U> toMap(Function<? super E, ? extends K> keyMapper, Function<? super E, ? extends U> valueMapper, BiFunction<U, U, U> mergeFunction) {
|
||||
return this.toMap(keyMapper, valueMapper, (u, v) -> mergeFunction.apply(u, v), (Supplier<Map<K, U>>) HashMap::new);
|
||||
}
|
||||
|
||||
public final <K, U> Map<K, U> toMap(Function<? super E, ? extends K> keyMapper, Function<? super E, ? extends U> valueMapper) {
|
||||
return this.toMap(keyMapper, valueMapper, (u, v) -> {
|
||||
throw new IllegalStateException(String.format("Duplicate key %s", u));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public final <K> Map<K, List<E>> toGroupingBy(Function<? super E, ? extends K> classifier) {
|
||||
return toGroupingBy(classifier, (Supplier<Map<K, List<E>>>) HashMap::new);
|
||||
}
|
||||
|
||||
public final <K> Map<K, List<E>> toGroupingBy(Function<? super E, ? extends K> classifier, Supplier<Map<K, List<E>>> mapFactory) {
|
||||
|
||||
BiConsumer<Map<K, List<E>>, E> accumulator = (map, element) -> {
|
||||
K key = classifier.apply(element);
|
||||
if (map.containsKey(key)) {
|
||||
List<E> temp = map.get(key);
|
||||
temp.add(element);
|
||||
} else {
|
||||
List<E> list = new ArrayList<>();
|
||||
list.add(element);
|
||||
map.put(key, list);
|
||||
}
|
||||
};
|
||||
return toCollect(mapFactory, accumulator);
|
||||
}
|
||||
|
||||
|
||||
public final E toJoin(BiFunction<E, E, E> biFunction) {
|
||||
requireNonNull(biFunction);
|
||||
BiFunction<E, E, E> temp = (t, u) -> {
|
||||
if (t == null) {
|
||||
return u;
|
||||
} else {
|
||||
return biFunction.apply(t, u);
|
||||
}
|
||||
};
|
||||
E apply = null;
|
||||
if (isPresent()) {
|
||||
for (int i = 0, len = value.size() - 1; i <= len; i++) {
|
||||
apply = temp.apply(apply, value.get(i));
|
||||
}
|
||||
}
|
||||
return apply;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public final String toString() {
|
||||
return isPresent() ? value.toString() : super.toString();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public interface Supplier<T> {
|
||||
|
||||
/**
|
||||
* Gets a result.
|
||||
*
|
||||
* @return a result
|
||||
*/
|
||||
T get();
|
||||
}
|
||||
|
||||
public interface BiConsumer<T, U> {
|
||||
|
||||
/**
|
||||
* Performs this operation on the given arguments.
|
||||
*
|
||||
* @param t the first input argument
|
||||
* @param u the second input argument
|
||||
*/
|
||||
void accept(T t, U u);
|
||||
}
|
||||
|
||||
public interface BiFunction<T, U, R> {
|
||||
|
||||
/**
|
||||
* Applies this function to the given arguments.
|
||||
*
|
||||
* @param t the first function argument
|
||||
* @param u the second function argument
|
||||
* @return the function result
|
||||
*/
|
||||
R apply(T t, U u);
|
||||
}
|
||||
|
||||
public interface Consumer<T> {
|
||||
/**
|
||||
* Performs this operation on the given argument.
|
||||
*
|
||||
* @param t the input argument
|
||||
*/
|
||||
void accept(T t);
|
||||
}
|
||||
|
||||
public interface Predicate<T> {
|
||||
/**
|
||||
* Evaluates this predicate on the given argument.
|
||||
*
|
||||
* @param t the input argument
|
||||
* @return {@code true} if the input argument matches the predicate,
|
||||
* otherwise {@code false}
|
||||
*/
|
||||
boolean test(T t);
|
||||
|
||||
}
|
||||
|
||||
public interface Function<T, R> {
|
||||
|
||||
/**
|
||||
* Applies this function to the given argument.
|
||||
*
|
||||
* @param t the function argument
|
||||
* @return the function result
|
||||
*/
|
||||
R apply(T t);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.mogo.utils.sqlite.proxy
|
||||
|
||||
import com.mogo.utils.logger.Logger
|
||||
import com.mogo.utils.network.utils.GsonUtil
|
||||
import java.lang.reflect.InvocationHandler
|
||||
import java.lang.reflect.Method
|
||||
import java.lang.reflect.Proxy
|
||||
@@ -39,11 +38,10 @@ class BaseDaoProxyLog : InvocationHandler {
|
||||
*/
|
||||
@Throws(Throwable::class)
|
||||
override fun invoke(proxy: Any, method: Method, args: Array<Any>): Any? {
|
||||
var result: Any? = null
|
||||
//反射方法前调用
|
||||
Logger.i("SQL数据库管理", "当前执行>>${method.name}>>")
|
||||
//反射执行方法 相当于调用target.sayHelllo;
|
||||
result = method.invoke(target, *args)
|
||||
val result: Any? = method.invoke(target, *args)
|
||||
//反射方法后调用.
|
||||
Logger.i("SQL数据库管理", "执行结果>>$result")
|
||||
return result
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
package com.mogo.map.impl.amap.navi;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.amap.api.navi.AMapNavi;
|
||||
import com.amap.api.navi.enums.AimLessMode;
|
||||
import com.mogo.map.navi.IMogoAimless;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.storage.SharedPrefsMgr;
|
||||
|
||||
/**
|
||||
* @author donghongyu
|
||||
* @since 2020-11-05
|
||||
* <p>
|
||||
* 高德巡航
|
||||
*/
|
||||
public class AimlessClient implements IMogoAimless {
|
||||
|
||||
/**
|
||||
* 巡航状态控制
|
||||
*/
|
||||
public static final String KEY_AIMLESS_STATUS = "KEY_AIMLESS_STATUS";
|
||||
|
||||
private static final String TAG = "AimlessClient";
|
||||
private final Context mContext;
|
||||
|
||||
private AMapNavi mAMapNavi;
|
||||
|
||||
private AimlessModeListenerAdapter mAimlessModeListener;
|
||||
|
||||
private static volatile AimlessClient sInstance;
|
||||
|
||||
/**
|
||||
* 巡航模式配置状态
|
||||
*/
|
||||
private boolean mAimlessModeStatus;
|
||||
|
||||
/**
|
||||
* 巡航状态
|
||||
*/
|
||||
private boolean mAimlessStatus;
|
||||
|
||||
private AimlessClient(Context context) {
|
||||
mContext = context.getApplicationContext();
|
||||
// 按需初始化高德导航组件
|
||||
initAMapNavi();
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化导航组件
|
||||
*/
|
||||
private void initAMapNavi() {
|
||||
Logger.d(TAG, "initAMapNavi");
|
||||
if (mAMapNavi != null) {
|
||||
return;
|
||||
}
|
||||
mAMapNavi = AMapNavi.getInstance(mContext);
|
||||
mAMapNavi.setEmulatorNaviSpeed(120);
|
||||
mAMapNavi.setUseInnerVoice(true, true);
|
||||
// mAMapNavi.stopSpeak();
|
||||
mAimlessModeListener = new AimlessModeListenerAdapter() {
|
||||
};
|
||||
mAMapNavi.addAimlessModeListener(mAimlessModeListener);
|
||||
mAimlessModeStatus = SharedPrefsMgr.getInstance(mContext).getBoolean(KEY_AIMLESS_STATUS, false);
|
||||
}
|
||||
|
||||
public static AimlessClient getInstance(Context context) {
|
||||
if (sInstance == null) {
|
||||
synchronized (AimlessClient.class) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new AimlessClient(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
private boolean checkAMapNavi() {
|
||||
if (mAMapNavi == null) {
|
||||
Logger.e(TAG, "高德导航实例为空!!!");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startAimlessMode() {
|
||||
if (!checkAMapNavi()) {
|
||||
return;
|
||||
}
|
||||
if (mAimlessModeStatus) {
|
||||
mAMapNavi.startAimlessMode(AimLessMode.CAMERA_AND_SPECIALROAD_DETECTED);
|
||||
mAimlessStatus = true;
|
||||
Logger.d(TAG, "开启巡航成功");
|
||||
} else {
|
||||
mAimlessStatus = false;
|
||||
Logger.d(TAG, "开启巡航失败");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopAimlessMode() {
|
||||
if (!checkAMapNavi()) {
|
||||
return;
|
||||
}
|
||||
mAMapNavi.stopAimlessMode();
|
||||
mAimlessStatus = false;
|
||||
Logger.d(TAG, "关闭巡航成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAimlessModeStatus(boolean open) {
|
||||
this.mAimlessModeStatus = open;
|
||||
SharedPrefsMgr.getInstance(mContext).putBoolean(KEY_AIMLESS_STATUS, open);
|
||||
if (open) {
|
||||
if (!mAimlessStatus) {
|
||||
startAimlessMode();
|
||||
}
|
||||
} else {
|
||||
if (mAimlessStatus) {
|
||||
stopAimlessMode();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -44,7 +44,6 @@ public class AimlessModeListenerAdapter implements AimlessModeListener {
|
||||
@Override
|
||||
public void updateAimlessModeCongestionInfo( AimLessModeCongestionInfo aimLessModeCongestionInfo ) {
|
||||
Logger.d( TAG, "updateAimlessModeCongestionInfo " + GsonUtil.jsonFromObject(aimLessModeCongestionInfo));
|
||||
|
||||
MogoCongestionInfo congestionInfo = ObjectUtils.fromAMap( aimLessModeCongestionInfo );
|
||||
if ( congestionInfo != null ) {
|
||||
MogoNaviListenerHandler.getInstance().onUpdateCongestion( congestionInfo );
|
||||
|
||||
@@ -13,12 +13,10 @@ import com.amap.api.navi.model.AMapNaviPath;
|
||||
import com.amap.api.navi.model.NaviLatLng;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.impl.amap.AMapWrapper;
|
||||
import com.mogo.map.impl.amap.message.AMapMessageManager;
|
||||
import com.mogo.map.impl.amap.utils.ObjectUtils;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
||||
import com.mogo.map.navi.IMogoNavi;
|
||||
import com.mogo.map.navi.MogoCalculatePath;
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
package com.mogo.map.impl.amap.search;
|
||||
|
||||
import com.amap.api.services.core.LatLonPoint;
|
||||
import com.amap.api.services.traffic.CircleTrafficQuery;
|
||||
import com.amap.api.services.traffic.RoadTrafficQuery;
|
||||
import com.amap.api.services.traffic.TrafficSearch;
|
||||
import com.amap.api.services.traffic.TrafficStatusEvaluation;
|
||||
import com.amap.api.services.traffic.TrafficStatusInfo;
|
||||
import com.amap.api.services.traffic.TrafficStatusResult;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.search.traffic.IMogoTrafficSearch;
|
||||
import com.mogo.map.search.traffic.IMogoTrafficSearchListener;
|
||||
import com.mogo.map.search.traffic.MogoTrafficResult;
|
||||
import com.mogo.map.search.traffic.MogoTrafficStatusEvaluation;
|
||||
import com.mogo.map.search.traffic.MogoTrafficStatusInfo;
|
||||
import com.mogo.utils.Dispatch;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class TrafficSearchClient implements IMogoTrafficSearch, TrafficSearch.OnTrafficSearchListener {
|
||||
|
||||
private static final String TAG = "TrafficSearchClient";
|
||||
private static final int DEFAULT_SEARCH_RADIUS = 500;
|
||||
|
||||
private IMogoTrafficSearchListener mListener;
|
||||
private TrafficSearch trafficSearch;
|
||||
|
||||
public TrafficSearchClient() {
|
||||
if (trafficSearch == null) {
|
||||
trafficSearch = new TrafficSearch(AbsMogoApplication.getApp().getApplicationContext());
|
||||
trafficSearch.setTrafficSearchListener(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void searchTrafficByRoad(String adCode, String roadName) {
|
||||
if (adCode == null || roadName == null) {
|
||||
if (mListener != null) {
|
||||
mListener.onTrafficSearchError("adCode or roadName can not be null");
|
||||
}
|
||||
return;
|
||||
}
|
||||
String formatRoadName = roadName.replace("/", "").replace(",", "");
|
||||
Logger.d(TAG, "searchTrafficByRoad formatRoad : " + formatRoadName);
|
||||
RoadTrafficQuery roadTrafficQuery = new RoadTrafficQuery(formatRoadName, adCode, TrafficSearch.ROAD_LEVEL_NONAME_WAY);
|
||||
try {
|
||||
trafficSearch.loadTrafficByRoadAsyn(roadTrafficQuery);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
if (mListener != null) {
|
||||
mListener.onTrafficSearchError(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void searchTrafficByCircleArea(MogoLatLng mogoLatLng, int radius) {
|
||||
if (mogoLatLng == null) {
|
||||
if (mListener != null) {
|
||||
mListener.onTrafficSearchError("adCode or roadName can not be null");
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (radius <= 0) {
|
||||
radius = DEFAULT_SEARCH_RADIUS;
|
||||
}
|
||||
CircleTrafficQuery circleTrafficQuery = new CircleTrafficQuery(new LatLonPoint(mogoLatLng.getLat(), mogoLatLng.lon), radius, TrafficSearch.ROAD_LEVEL_NONAME_WAY);
|
||||
Logger.d(TAG, "loadTrafficByCircle circleTrafficQuery : " + circleTrafficQuery.toString());
|
||||
try {
|
||||
trafficSearch.loadTrafficByCircleAsyn(circleTrafficQuery);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
if (mListener != null) {
|
||||
mListener.onTrafficSearchError(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerTrafficSearchListener(IMogoTrafficSearchListener listener) {
|
||||
mListener = listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRoadTrafficSearched(TrafficStatusResult trafficStatusResult, int i) {
|
||||
if (mListener == null) {
|
||||
return;
|
||||
}
|
||||
if (trafficStatusResult != null && i == 1000) {
|
||||
Logger.d(TAG, "onRoadTrafficSearched result : " + GsonUtil.jsonFromObject(trafficStatusResult));
|
||||
long startTime = System.currentTimeMillis();
|
||||
|
||||
List<MogoTrafficStatusInfo> trafficStatusInfoList = new ArrayList<>();
|
||||
List<TrafficStatusInfo> statusInfo = trafficStatusResult.getRoads();
|
||||
Dispatch.stream(statusInfo).forEach(info -> {
|
||||
MogoTrafficStatusInfo mogoTrafficStatusInfo = new MogoTrafficStatusInfo();
|
||||
mogoTrafficStatusInfo.setAngle(info.getAngle());
|
||||
mogoTrafficStatusInfo.setDirection(info.getDirection());
|
||||
mogoTrafficStatusInfo.setName(info.getName());
|
||||
mogoTrafficStatusInfo.setStatus(info.getStatus());
|
||||
List<MogoLatLng> mogoLatLngs = new ArrayList<>();
|
||||
Dispatch.stream(info.getCoordinates()).forEach(latLonPoint -> mogoLatLngs.add(new MogoLatLng(latLonPoint.getLatitude(), latLonPoint.getLongitude())));
|
||||
mogoTrafficStatusInfo.setMogoLatLngs(mogoLatLngs);
|
||||
trafficStatusInfoList.add(mogoTrafficStatusInfo);
|
||||
});
|
||||
MogoTrafficResult mogoTrafficResult = new MogoTrafficResult();
|
||||
mogoTrafficResult.setDescription(trafficStatusResult.getDescription());
|
||||
mogoTrafficResult.setTrafficStatusInfos(trafficStatusInfoList);
|
||||
long endTime = System.currentTimeMillis();
|
||||
Logger.d(TAG, "onRoadTrafficSearched MogoTrafficResult : " + GsonUtil.jsonFromObject(mogoTrafficResult));
|
||||
Logger.d(TAG, "onRoadTrafficSearched countTime : " + (endTime - startTime));
|
||||
mListener.onTrafficSearchInfo(mogoTrafficResult);
|
||||
} else {
|
||||
mListener.onTrafficSearchError("交通态势查询返回 errorCode : " + i + " trafficStatusResult : " + trafficStatusResult);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -164,6 +164,7 @@ public class ObjectUtils {
|
||||
location.setAoiName( aLocation.getAoiName() );
|
||||
location.setErrCode( aLocation.getErrorCode() );
|
||||
location.setErrInfo( aLocation.getErrorInfo() );
|
||||
location.setStreet( aLocation.getStreet() );
|
||||
location.setStreetNum( aLocation.getStreetNum() );
|
||||
location.setDescription( aLocation.getDescription() );
|
||||
location.setBuildingId( aLocation.getBuildingId() );
|
||||
|
||||
@@ -24,6 +24,7 @@ public class MogoLocation implements Cloneable, Parcelable {
|
||||
private String aoiName = "";
|
||||
private int errCode = 0;
|
||||
private String errInfo = "";
|
||||
private String street = "";
|
||||
private String streetNum = "";
|
||||
private String description = "";
|
||||
private String buildingId = "";
|
||||
@@ -103,6 +104,14 @@ public class MogoLocation implements Cloneable, Parcelable {
|
||||
this.errInfo = errInfo;
|
||||
}
|
||||
|
||||
public String getStreet() {
|
||||
return street;
|
||||
}
|
||||
|
||||
public void setStreet(String street) {
|
||||
this.street = street;
|
||||
}
|
||||
|
||||
public String getStreetNum() {
|
||||
return streetNum;
|
||||
}
|
||||
@@ -177,6 +186,7 @@ public class MogoLocation implements Cloneable, Parcelable {
|
||||
", aoiName='" + aoiName + '\'' +
|
||||
", errCode=" + errCode +
|
||||
", errInfo='" + errInfo + '\'' +
|
||||
", street='" + street + '\'' +
|
||||
", streetNum='" + streetNum + '\'' +
|
||||
", description='" + description + '\'' +
|
||||
", buildingId='" + buildingId + '\'' +
|
||||
@@ -311,6 +321,7 @@ public class MogoLocation implements Cloneable, Parcelable {
|
||||
dest.writeString( this.aoiName );
|
||||
dest.writeInt( this.errCode );
|
||||
dest.writeString( this.errInfo );
|
||||
dest.writeString( this.street );
|
||||
dest.writeString( this.streetNum );
|
||||
dest.writeString( this.description );
|
||||
dest.writeString( this.buildingId );
|
||||
@@ -340,6 +351,7 @@ public class MogoLocation implements Cloneable, Parcelable {
|
||||
this.aoiName = in.readString();
|
||||
this.errCode = in.readInt();
|
||||
this.errInfo = in.readString();
|
||||
this.street = in.readString();
|
||||
this.streetNum = in.readString();
|
||||
this.description = in.readString();
|
||||
this.buildingId = in.readString();
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.mogo.map.navi;
|
||||
|
||||
/**
|
||||
* @author donghongyu
|
||||
* @since 2020-11-05
|
||||
* <p>
|
||||
* 巡航操作
|
||||
*/
|
||||
public interface IMogoAimless {
|
||||
|
||||
/**
|
||||
* 打开巡航模式
|
||||
*/
|
||||
void startAimlessMode();
|
||||
|
||||
/**
|
||||
* 关闭巡航模式
|
||||
*/
|
||||
void stopAimlessMode();
|
||||
|
||||
/**
|
||||
* 设置巡航模式状态
|
||||
*
|
||||
* @param open
|
||||
*/
|
||||
void setAimlessModeStatus(boolean open);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.mogo.map.search.traffic;
|
||||
|
||||
import com.mogo.map.MogoLatLng;
|
||||
|
||||
public interface IMogoTrafficSearch {
|
||||
|
||||
/**
|
||||
* 根据道路名称查询交通态势
|
||||
*
|
||||
* @param adCode 城市code
|
||||
* @param roadName 道路名称
|
||||
*/
|
||||
void searchTrafficByRoad(String adCode,String roadName);
|
||||
|
||||
/**
|
||||
* 根据圆形区域查询交通态势
|
||||
*
|
||||
* @param mogoLatLng 中心点坐标
|
||||
* @param radius 查询半径
|
||||
*/
|
||||
void searchTrafficByCircleArea(MogoLatLng mogoLatLng,int radius);
|
||||
|
||||
/**
|
||||
* 交通态势查询监听
|
||||
*
|
||||
* @param listener
|
||||
*/
|
||||
void registerTrafficSearchListener(IMogoTrafficSearchListener listener);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.mogo.map.search.traffic;
|
||||
|
||||
public interface IMogoTrafficSearchListener {
|
||||
|
||||
void onTrafficSearchInfo(MogoTrafficResult trafficResult);
|
||||
|
||||
void onTrafficSearchError(String errorMsg);
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.mogo.map.search.traffic;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MogoTrafficResult {
|
||||
|
||||
//路况描述信息
|
||||
private String description;
|
||||
|
||||
//路况评价信息
|
||||
private MogoTrafficStatusEvaluation evaluation;
|
||||
|
||||
//道路列表
|
||||
private List<MogoTrafficStatusInfo> trafficStatusInfos;
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public MogoTrafficStatusEvaluation getEvaluation() {
|
||||
return evaluation;
|
||||
}
|
||||
|
||||
public void setEvaluation(MogoTrafficStatusEvaluation evaluation) {
|
||||
this.evaluation = evaluation;
|
||||
}
|
||||
|
||||
public List<MogoTrafficStatusInfo> getTrafficStatusInfos() {
|
||||
return trafficStatusInfos;
|
||||
}
|
||||
|
||||
public void setTrafficStatusInfos(List<MogoTrafficStatusInfo> trafficStatusInfos) {
|
||||
this.trafficStatusInfos = trafficStatusInfos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MogoTrafficResult{" +
|
||||
"description='" + description + '\'' +
|
||||
", evaluation=" + evaluation +
|
||||
", trafficStatusInfos=" + trafficStatusInfos +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package com.mogo.map.search.traffic;
|
||||
|
||||
//交通态势搜索返回的路况信息
|
||||
public class MogoTrafficStatusEvaluation {
|
||||
|
||||
//拥堵所占百分比
|
||||
private String blocked;
|
||||
|
||||
//缓行所占百分比
|
||||
private String congested;
|
||||
|
||||
//路况描述
|
||||
private String description;
|
||||
|
||||
//畅通所占百分比
|
||||
private String expedite;
|
||||
|
||||
//路况状态
|
||||
private String status;
|
||||
|
||||
//未知路段所占百分比
|
||||
private String unKnown;
|
||||
|
||||
public String getBlocked() {
|
||||
return blocked;
|
||||
}
|
||||
|
||||
public void setBlocked(String blocked) {
|
||||
this.blocked = blocked;
|
||||
}
|
||||
|
||||
public String getCongested() {
|
||||
return congested;
|
||||
}
|
||||
|
||||
public void setCongested(String congested) {
|
||||
this.congested = congested;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getExpedite() {
|
||||
return expedite;
|
||||
}
|
||||
|
||||
public void setExpedite(String expedite) {
|
||||
this.expedite = expedite;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getUnKnown() {
|
||||
return unKnown;
|
||||
}
|
||||
|
||||
public void setUnKnown(String unKnown) {
|
||||
this.unKnown = unKnown;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MogoTrafficStatusEvaluation{" +
|
||||
"blocked='" + blocked + '\'' +
|
||||
", congested='" + congested + '\'' +
|
||||
", description='" + description + '\'' +
|
||||
", expedite='" + expedite + '\'' +
|
||||
", status='" + status + '\'' +
|
||||
", unKnown='" + unKnown + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package com.mogo.map.search.traffic;
|
||||
|
||||
import com.mogo.map.MogoLatLng;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
//交通态势查询结果返回道路信息
|
||||
public class MogoTrafficStatusInfo {
|
||||
|
||||
//车行角度
|
||||
private int angle;
|
||||
|
||||
//坐标集合
|
||||
private List<MogoLatLng> mogoLatLngs;
|
||||
|
||||
//方向描述
|
||||
private String direction;
|
||||
|
||||
//方向
|
||||
private String lcodes;
|
||||
|
||||
//设置的道路名称
|
||||
private String name;
|
||||
|
||||
//路况状态
|
||||
private String status;
|
||||
|
||||
public int getAngle() {
|
||||
return angle;
|
||||
}
|
||||
|
||||
public void setAngle(int angle) {
|
||||
this.angle = angle;
|
||||
}
|
||||
|
||||
public List<MogoLatLng> getMogoLatLngs() {
|
||||
return mogoLatLngs;
|
||||
}
|
||||
|
||||
public void setMogoLatLngs(List<MogoLatLng> mogoLatLngs) {
|
||||
this.mogoLatLngs = mogoLatLngs;
|
||||
}
|
||||
|
||||
public String getDirection() {
|
||||
return direction;
|
||||
}
|
||||
|
||||
public void setDirection(String direction) {
|
||||
this.direction = direction;
|
||||
}
|
||||
|
||||
public String getLcodes() {
|
||||
return lcodes;
|
||||
}
|
||||
|
||||
public void setLcodes(String lcodes) {
|
||||
this.lcodes = lcodes;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MogoTrafficStatusInfo{" +
|
||||
"angle=" + angle +
|
||||
", mogoLatLngs=" + mogoLatLngs +
|
||||
", direction='" + direction + '\'' +
|
||||
", lcodes='" + lcodes + '\'' +
|
||||
", name='" + name + '\'' +
|
||||
", status='" + status + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.mogo.map;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.map.impl.amap.navi.AimlessClient;
|
||||
import com.mogo.map.navi.IMogoAimless;
|
||||
import com.mogo.map.navi.IMogoNavi;
|
||||
|
||||
/**
|
||||
* @author donghongyu
|
||||
* @since 2020-11-05
|
||||
* <p>
|
||||
* 巡航代理
|
||||
*/
|
||||
public class MogoAimless implements IMogoAimless {
|
||||
|
||||
private IMogoAimless mDelegate;
|
||||
|
||||
private static volatile MogoAimless sInstance;
|
||||
|
||||
private MogoAimless(Context context) {
|
||||
mDelegate = AimlessClient.getInstance(context);
|
||||
}
|
||||
|
||||
public static MogoAimless getInstance(Context context) {
|
||||
if (sInstance == null) {
|
||||
synchronized (MogoAimless.class) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new MogoAimless(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startAimlessMode() {
|
||||
if (mDelegate != null) {
|
||||
mDelegate.startAimlessMode();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopAimlessMode() {
|
||||
if (mDelegate != null) {
|
||||
mDelegate.stopAimlessMode();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAimlessModeStatus(boolean open) {
|
||||
if (mDelegate != null) {
|
||||
mDelegate.setAimlessModeStatus(open);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,6 @@
|
||||
package com.mogo.map;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Rect;
|
||||
import android.location.Location;
|
||||
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.mogo.map;
|
||||
|
||||
import com.mogo.map.impl.amap.search.TrafficSearchClient;
|
||||
import com.mogo.map.search.traffic.IMogoTrafficSearch;
|
||||
import com.mogo.map.search.traffic.IMogoTrafficSearchListener;
|
||||
|
||||
public class MogoTrafficSearch implements IMogoTrafficSearch {
|
||||
|
||||
private IMogoTrafficSearch mDelegate;
|
||||
|
||||
public MogoTrafficSearch() {
|
||||
mDelegate = new TrafficSearchClient();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void searchTrafficByRoad(String adCode, String roadName) {
|
||||
if (mDelegate != null) {
|
||||
mDelegate.searchTrafficByRoad(adCode, roadName);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void searchTrafficByCircleArea(MogoLatLng mogoLatLng, int radius) {
|
||||
if (mDelegate != null) {
|
||||
mDelegate.searchTrafficByCircleArea(mogoLatLng, radius);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerTrafficSearchListener(IMogoTrafficSearchListener listener) {
|
||||
if (mDelegate != null) {
|
||||
mDelegate.registerTrafficSearchListener(listener);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -45,7 +45,7 @@ class LogAspectj {
|
||||
var stopNanos = System.nanoTime()
|
||||
var lengthMill = TimeUnit.NANOSECONDS.toMillis(stopNanos - startNanos)
|
||||
|
||||
exitMethod(joinPoint, result as Any?, lengthMill)
|
||||
exitMethod(joinPoint, result, lengthMill)
|
||||
}
|
||||
|
||||
private fun enterMethod(joinPoint: ProceedingJoinPoint) {
|
||||
@@ -59,7 +59,7 @@ class LogAspectj {
|
||||
|
||||
var builder = StringBuilder("\u21E2 ")
|
||||
builder.append(methodName).append('(')
|
||||
parameterValues.forEachIndexed { index, any ->
|
||||
parameterValues.forEachIndexed { index, _ ->
|
||||
if (index > 0) {
|
||||
builder.append(",")
|
||||
}
|
||||
|
||||
@@ -1,14 +1,6 @@
|
||||
package com.zhidao.roadcondition.model
|
||||
|
||||
|
||||
fun CommonConfig.isActiveNonNull():Boolean{
|
||||
return active!=null
|
||||
}
|
||||
|
||||
//fun CommonConfig.isPromotionNonNull():Boolean{
|
||||
// return promotion!=null
|
||||
//}
|
||||
|
||||
class CommonConfig {
|
||||
|
||||
var active:Active //活动配置
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
package com.zhidao.roadcondition.model.proxy
|
||||
|
||||
import androidx.annotation.IntDef
|
||||
import java.lang.annotation.Retention
|
||||
import java.lang.annotation.RetentionPolicy
|
||||
|
||||
|
||||
const val INFO_TYPE_GONE = 0
|
||||
const val INFO_TYPE_SHOW = 1
|
||||
|
||||
|
||||
@IntDef(INFO_TYPE_GONE, INFO_TYPE_SHOW)
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
annotation class ActiveInfoType
|
||||
|
||||
fun isActiveShow(@ActiveInfoType type: Int): Boolean {
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package com.zhidao.roadcondition.model.proxy
|
||||
|
||||
import androidx.annotation.IntDef
|
||||
import java.lang.annotation.Retention
|
||||
import java.lang.annotation.RetentionPolicy
|
||||
|
||||
|
||||
const val INFO_TYPE_IMG = 0 //图片
|
||||
@@ -12,5 +10,5 @@ const val INFO_TYPE_WORD = 3
|
||||
|
||||
|
||||
@IntDef(INFO_TYPE_IMG, INFO_TYPE_VIDEO, INFO_TYPE_VOICE, INFO_TYPE_WORD)
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
annotation class InformationsType
|
||||
|
||||
@@ -36,7 +36,7 @@ class CoroutineChain {
|
||||
return request(loader, true)
|
||||
}
|
||||
|
||||
fun <T> LifecycleOwner.request(loader: suspend () -> T, needAutoCancel: Boolean = true): Deferred<T> {
|
||||
private fun <T> LifecycleOwner.request(loader: suspend () -> T, needAutoCancel: Boolean = true): Deferred<T> {
|
||||
val deferred = GlobalScope.async(Dispatchers.IO, start = CoroutineStart.LAZY) {
|
||||
loader()
|
||||
}
|
||||
@@ -58,9 +58,9 @@ class CoroutineChain {
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
when (e) {
|
||||
is UnknownHostException -> onError?.invoke(ApiException.NETWORK_API_EXCEPTION)
|
||||
is TimeoutException -> onError?.invoke(ApiException.NETWORK_API_EXCEPTION)
|
||||
is SocketTimeoutException -> onError?.invoke(ApiException.NETWORK_API_EXCEPTION)
|
||||
is UnknownHostException -> onError.invoke(ApiException.NETWORK_API_EXCEPTION)
|
||||
is TimeoutException -> onError.invoke(ApiException.NETWORK_API_EXCEPTION)
|
||||
is SocketTimeoutException -> onError.invoke(ApiException.NETWORK_API_EXCEPTION)
|
||||
else -> onError(e)
|
||||
}
|
||||
} finally {
|
||||
|
||||
@@ -12,7 +12,7 @@ import java.util.*
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
|
||||
class HttpClient {
|
||||
class HttpClient private constructor(baseUrl: String) {
|
||||
|
||||
companion object {
|
||||
const val DEFAULT_CONNECT_TIME = 30L
|
||||
@@ -52,10 +52,10 @@ class HttpClient {
|
||||
|
||||
}
|
||||
|
||||
private lateinit var retrofit: Retrofit
|
||||
private lateinit var httpApi: HttpApi
|
||||
private var retrofit: Retrofit
|
||||
private var httpApi: HttpApi
|
||||
|
||||
private constructor(baseUrl: String) {
|
||||
init {
|
||||
retrofit = Retrofit.Builder()
|
||||
.client(getOkHttpClient())
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
|
||||
@@ -32,12 +32,12 @@ class PostCommonBody : RequestBody {
|
||||
}
|
||||
|
||||
override fun writeTo(sink: BufferedSink) {
|
||||
if (content.isNullOrEmpty()) {
|
||||
if (content.isEmpty()) {
|
||||
throw NullPointerException("content == null")
|
||||
}
|
||||
val bytes = content.toByteArray(charset)
|
||||
Util.checkOffsetAndCount(bytes!!.size.toLong(), 0, bytes!!.size.toLong())
|
||||
sink.write(bytes, 0, bytes!!.size)
|
||||
Util.checkOffsetAndCount(bytes.size.toLong(), 0, bytes.size.toLong())
|
||||
sink.write(bytes, 0, bytes.size)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -45,13 +45,13 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
|
||||
}
|
||||
|
||||
fun registerTakePhotoInterceptor(interceptor: TakePhotoInterceptor) {
|
||||
interceptor?.apply {
|
||||
interceptor.apply {
|
||||
interceptors.add(this)
|
||||
}
|
||||
}
|
||||
|
||||
fun unregisterTakePhotoInterceptor(interceptor: TakePhotoInterceptor) {
|
||||
interceptor?.apply {
|
||||
interceptor.apply {
|
||||
interceptors.remove(interceptor)
|
||||
}
|
||||
}
|
||||
@@ -152,14 +152,14 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
|
||||
|
||||
fun release() {
|
||||
zdCarCoderController.release()
|
||||
interceptors?.clear()
|
||||
interceptors.clear()
|
||||
}
|
||||
|
||||
//拍照失败回调
|
||||
override fun onTakePhotoFail(photoType: Int, camera: Int) {
|
||||
trackGetPhoto(3)
|
||||
interceptors.forEach {
|
||||
it?.onTakePhotoFail(photoType, camera)
|
||||
it.onTakePhotoFail(photoType, camera)
|
||||
}
|
||||
val isCustom = CustomStatusHandler.pollPhotoStatus()
|
||||
val entity = TakeEntity(isCustom, 0L)
|
||||
@@ -190,7 +190,7 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
|
||||
if (isCustom) {
|
||||
CosStatusController().sendInformationDirectly(
|
||||
INFO_TYPE_IMG,
|
||||
mutableMapOf("pic" to "" as String),
|
||||
mutableMapOf("pic" to ""),
|
||||
mType,
|
||||
entity,
|
||||
mainInfoId,
|
||||
@@ -215,8 +215,8 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
|
||||
|
||||
var interceptor = false
|
||||
interceptors.forEach {
|
||||
interceptor = it?.intercept()
|
||||
it?.onTakePhotoSuccess(photoType, camera, photoPath)
|
||||
interceptor = it.intercept()
|
||||
it.onTakePhotoSuccess(photoType, camera, photoPath)
|
||||
}
|
||||
if (interceptor) {
|
||||
return
|
||||
@@ -352,11 +352,11 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
|
||||
val entity = CustomStatusHandler.pollVideoStatus()
|
||||
|
||||
entity?.let {
|
||||
InformationUploadController.release(entity.id)
|
||||
Log.e(TAG, "getVideo onTakeVideoFail entity?.isCustom =" + entity?.isCustom)
|
||||
if (entity?.isCustom) {
|
||||
InformationUploadController.release(it.id)
|
||||
Log.e(TAG, "getVideo onTakeVideoFail entity?.isCustom =" + it.isCustom)
|
||||
// if (it.isCustom) {
|
||||
// sendGetInfoFailedReceiver(mType)
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
//失败了,传空地址,发起请求
|
||||
|
||||
@@ -27,11 +27,11 @@ object CosCallbackMapController : CosStatusCallback {
|
||||
this.uploadFailed = uploadFailed
|
||||
}
|
||||
|
||||
fun registerCallback(paths: List<String>, callback: CosStatusCallback) {
|
||||
fun registerCallback(paths: List<String?>?, callback: CosStatusCallback) {
|
||||
paths?.let { list ->
|
||||
list.forEach { path ->
|
||||
path?.let {
|
||||
map[path] = callback
|
||||
map[it] = callback
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ class CosStatusController : CosStatusCallback {
|
||||
var mSpeed: Float = 0f
|
||||
|
||||
//上传文件
|
||||
fun uploadFile(picPath: MutableList<String>, entity: TakeEntity, type: String, mainInfoId: Long,
|
||||
fun uploadFile(picPath: MutableList<String?>?, entity: TakeEntity, type: String, mainInfoId: Long,
|
||||
fromType: String, longitude: Double, latitude: Double, speed: Float) {
|
||||
CosCallbackMapController.registerCallback(picPath, this)
|
||||
// CosLogger.setLogStatus(true)
|
||||
@@ -58,6 +58,9 @@ class CosStatusController : CosStatusCallback {
|
||||
this.mSpeed = speed
|
||||
Log.d(TAG, "uploadFile type===$type ---- mainInfoId =$mainInfoId ----mFromType = $mFromType ---- picPath = $picPath --speed = $speed")
|
||||
trackUploadCos(3)
|
||||
if(picPath == null){
|
||||
return
|
||||
}
|
||||
if (picPath.contains("backPic")) return
|
||||
//参数说明: paths:本地文件路径;(注:上传的本地路径不要重复);config:文件上传的优先级
|
||||
mPicEventId =
|
||||
@@ -174,7 +177,7 @@ class CosStatusController : CosStatusCallback {
|
||||
mSpeed
|
||||
)
|
||||
}
|
||||
Log.d(TAG, "delete file: ${localPath!!}")
|
||||
Log.d(TAG, "delete file: $localPath")
|
||||
CosCallbackMapController.unregisterCallback(localPath)
|
||||
deletePicFile(localPath)
|
||||
}
|
||||
|
||||
@@ -203,12 +203,12 @@ class MainService : Service() {
|
||||
"MainService",
|
||||
"getImageEvent url = " + getImageSuccessEvent.getImageUrl() + ">>>>type =" + getImageSuccessEvent.getType()
|
||||
)
|
||||
sendMarkerInfoReceiver(
|
||||
info.latitude,
|
||||
info.longitude,
|
||||
getImageSuccessEvent.getImageUrl(),
|
||||
getImageSuccessEvent.getType()
|
||||
)
|
||||
// sendMarkerInfoReceiver(
|
||||
// info.latitude,
|
||||
// info.longitude,
|
||||
// getImageSuccessEvent.getImageUrl(),
|
||||
// getImageSuccessEvent.getType()
|
||||
// )
|
||||
}
|
||||
|
||||
private fun sendMarkerInfoReceiver(lat: Double, lon: Double, imageUrl: String?, type: String?) {
|
||||
|
||||
@@ -272,7 +272,7 @@ class MainServiceController {
|
||||
) {
|
||||
Log.d(TAG, " geoLocation -- poiType = $poiType")
|
||||
LocationUtil.getInstance()
|
||||
.geoCodeLocation(locationInfo.toLatLngPoint(), { locInfo: LocationInfo ->
|
||||
.geoCodeLocation(locationInfo.toLatLngPoint(), {
|
||||
Log.d(TAG, "geoLocation -------start -->")
|
||||
postInformationMessage(
|
||||
getInformationBody(type, url, locationInfo, isCustom, trafficInfoType, isShare, poiType,mainInfoId,longitude,latitude, speed),
|
||||
|
||||
@@ -50,9 +50,8 @@ fun deleteAllFile(file: File?) { //判断文件不为null或文件目录存在
|
||||
val files: Array<File> = file.listFiles()
|
||||
//遍历该目录下的文件对象
|
||||
for (f in files) {
|
||||
val name: String = file.getName()
|
||||
//判断子目录是否存在子目录,如果是文件则删除
|
||||
if (f.isDirectory()) {
|
||||
if (f.isDirectory) {
|
||||
deleteAllFile(f)
|
||||
} else {
|
||||
f.delete()
|
||||
|
||||
@@ -61,7 +61,7 @@ open class IMogoAuthorizeController {
|
||||
})
|
||||
}
|
||||
|
||||
private fun realInvokeAuthorizeContent(agreementType: Int, onStart: (() -> Unit), onSuccess: ((BaseResponse<AgreementData>) -> Unit), onError: ((String) -> Unit), needContent: Boolean = false) {
|
||||
private fun realInvokeAuthorizeContent(agreementType: Int, onStart: (() -> Unit), onSuccess: ((BaseResponse<AgreementData?>) -> Unit), onError: ((String) -> Unit), needContent: Boolean = false) {
|
||||
onStart.invoke()
|
||||
try {
|
||||
request<BaseResponse<AgreementData>> {
|
||||
|
||||
@@ -8,7 +8,7 @@ import com.mogo.module.authorize.model.proxy.toAuthorizeType
|
||||
import com.mogo.module.authorize.util.SharedPreferenceUtil.needAuthorization
|
||||
import com.mogo.utils.logger.Logger
|
||||
|
||||
open abstract class MogoAuthorizeManagerImpl : IMogoAuthorizeInvoke {
|
||||
abstract class MogoAuthorizeManagerImpl : IMogoAuthorizeInvoke {
|
||||
|
||||
companion object {
|
||||
const val TAG = "AuthorizeManagerImpl"
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package com.mogo.module.authorize.authprovider.biz
|
||||
|
||||
import android.content.Context
|
||||
@@ -11,7 +13,6 @@ import com.mogo.map.marker.IMogoMarkerClickListener
|
||||
import com.mogo.map.navi.IMogoNaviListener
|
||||
import com.mogo.module.authorize.authprovider.invoke.AuthorizeConstant.Companion.PATH_AGREEMENT_MODULE_NAME
|
||||
import com.mogo.module.authorize.authprovider.invoke.AuthorizeInvokerConstant.Companion.AUTHORIZE_TYPE_LAUNCHER_MAIN
|
||||
import com.mogo.module.authorize.authprovider.launcher.MogoMainAuthorize
|
||||
import com.mogo.module.authorize.authprovider.launcher.MogoMainAuthorize.Companion.mogoAuthShow
|
||||
import com.mogo.module.authorize.util.SharedPreferenceUtil.hasGuide
|
||||
import com.mogo.service.MogoServicePaths
|
||||
|
||||
@@ -42,9 +42,9 @@ class AuthorizeController {
|
||||
agreementContent: (id: Long, content: String, title: String, bottomContent: String, lastContent: String) -> Unit,
|
||||
agreementError: () -> Unit) {
|
||||
Logger.d(TAG, "requestContentSuccess userAgreement:$userAgreement")
|
||||
if (userAgreement.agreementContent.isNotEmpty()) {
|
||||
if (userAgreement.agreementContent!= null && userAgreement.agreementContent!!.isNotEmpty()) {
|
||||
val id = userAgreement.tUserAgreementEntity.id
|
||||
val content = userAgreement.agreementContent[0]
|
||||
val content = userAgreement.agreementContent!![0]
|
||||
val title = userAgreement.tUserAgreementEntity.title
|
||||
val bottomContent = userAgreement.tUserAgreementEntity.agreementButtonFirst
|
||||
val lastContent = userAgreement.tUserAgreementEntity.agreementButtonSecond
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.module.authorize.R
|
||||
import com.mogo.module.authorize.util.AnalyticsUtil
|
||||
import com.mogo.module.authorize.util.HtmlUtil
|
||||
import com.mogo.module.authorize.voice.IVoiceAuthorizeIntentListener
|
||||
import com.mogo.module.authorize.voice.IVoiceCommandListener
|
||||
import com.mogo.module.authorize.voice.VoiceUtil
|
||||
@@ -22,14 +23,15 @@ import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
class AuthorizeDialog : BaseFloatDialog, View.OnClickListener, IVoiceCommandListener, IVoiceAuthorizeIntentListener {
|
||||
class AuthorizeDialog(invokeTag: String, context: Context) : BaseFloatDialog(context),
|
||||
View.OnClickListener, IVoiceCommandListener, IVoiceAuthorizeIntentListener {
|
||||
|
||||
companion object {
|
||||
const val TAG = "AuthorizeDialog"
|
||||
}
|
||||
|
||||
private var mContext: Context? = null
|
||||
private var invokeTag: String? = null
|
||||
private var mContext: Context? = context
|
||||
private var invokeTag: String? = invokeTag
|
||||
|
||||
private var agreementId: Long = 0L
|
||||
|
||||
@@ -48,9 +50,7 @@ class AuthorizeDialog : BaseFloatDialog, View.OnClickListener, IVoiceCommandList
|
||||
|
||||
private var authorizeController: AuthorizeController? = null
|
||||
|
||||
constructor(invokeTag: String, context: Context) : super(context) {
|
||||
mContext = context
|
||||
this.invokeTag = invokeTag
|
||||
init {
|
||||
initView()
|
||||
}
|
||||
|
||||
@@ -62,24 +62,24 @@ class AuthorizeDialog : BaseFloatDialog, View.OnClickListener, IVoiceCommandList
|
||||
|
||||
private fun setWrapContent() {
|
||||
val mWindow = window
|
||||
if(DebugConfig.getCarMachineType() != DebugConfig.CAR_MACHINE_TYPE_BYD){
|
||||
if (mWindow != null && CarSeries.getSeries() == CarSeries.CAR_SERIES_F80X) {
|
||||
val lp = mWindow.attributes
|
||||
lp.width = 1920
|
||||
lp.height = 1080
|
||||
mWindow.attributes = lp
|
||||
}else{
|
||||
val lp = mWindow.attributes
|
||||
lp.width = 1024
|
||||
lp.height = 600
|
||||
mWindow.attributes = lp
|
||||
}
|
||||
}else{
|
||||
if (mWindow != null) {
|
||||
val lp = mWindow.attributes
|
||||
mWindow?.let {
|
||||
if (DebugConfig.getCarMachineType() != DebugConfig.CAR_MACHINE_TYPE_BYD) {
|
||||
if (CarSeries.getSeries() == CarSeries.CAR_SERIES_F80X) {
|
||||
val lp = it.attributes
|
||||
lp.width = 1920
|
||||
lp.height = 1080
|
||||
it.attributes = lp
|
||||
} else {
|
||||
val lp = it.attributes
|
||||
lp.width = 1024
|
||||
lp.height = 600
|
||||
it.attributes = lp
|
||||
}
|
||||
} else {
|
||||
val lp = it.attributes
|
||||
lp.width = 1920
|
||||
lp.height = 1000
|
||||
mWindow.attributes = lp
|
||||
it.attributes = lp
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -132,15 +132,15 @@ class AuthorizeDialog : BaseFloatDialog, View.OnClickListener, IVoiceCommandList
|
||||
this.agreementId = agreementId
|
||||
clLoadAuthorizeContainer?.visibility = View.GONE
|
||||
clContainer?.visibility = View.VISIBLE
|
||||
tvTitle?.text = Html.fromHtml(agreementTitle)
|
||||
tvTitle?.text = HtmlUtil.getSpanned(agreementTitle)
|
||||
GlobalScope.async(Dispatchers.IO) {
|
||||
val spannable = Html.fromHtml(agreementContent)
|
||||
val spannable = HtmlUtil.getSpanned(agreementContent)
|
||||
withContext(Dispatchers.Main) {
|
||||
tvContent?.text = spannable
|
||||
}
|
||||
}
|
||||
tvButtonContent?.text = Html.fromHtml(agreementBottom)
|
||||
tvLastContent?.text = Html.fromHtml(agreementLast)
|
||||
tvButtonContent?.text = HtmlUtil.getSpanned(agreementBottom)
|
||||
tvLastContent?.text = HtmlUtil.getSpanned(agreementLast)
|
||||
}
|
||||
|
||||
private fun showAuthorizationError() {
|
||||
|
||||
@@ -1,179 +0,0 @@
|
||||
package com.mogo.module.authorize.layout
|
||||
|
||||
import android.text.Html
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.widget.Button
|
||||
import android.widget.TextView
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.module.authorize.R
|
||||
import com.mogo.module.authorize.util.AnalyticsUtil
|
||||
import com.mogo.module.authorize.util.AnalyticsUtil.INVOKE_TRACK_AUTHORIZE_CLICK
|
||||
import com.mogo.module.authorize.util.AnalyticsUtil.INVOKE_TRACK_AUTHORIZE_SHOW
|
||||
import com.mogo.module.authorize.voice.IVoiceAuthorizeIntentListener
|
||||
import com.mogo.module.authorize.voice.IVoiceCommandListener
|
||||
import com.mogo.module.authorize.voice.VoiceUtil
|
||||
import com.mogo.utils.logger.Logger
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
class AuthorizeLayout(private val invokeTag: String) : View.OnClickListener, IVoiceCommandListener, IVoiceAuthorizeIntentListener {
|
||||
|
||||
companion object {
|
||||
const val TAG = "AuthorizeLayout"
|
||||
}
|
||||
|
||||
private var agreementId: Long = 0L
|
||||
|
||||
private var clTopParent: ConstraintLayout? = null
|
||||
private var clErrorContainer: ConstraintLayout? = null
|
||||
private var clLoadAuthorizeContainer: ConstraintLayout? = null
|
||||
private var clContainer: ConstraintLayout? = null
|
||||
private var clAuthorizeLoading: ConstraintLayout? = null
|
||||
private var btnAgree: Button? = null
|
||||
private var btnDisAgree: Button? = null
|
||||
private var btnLoadingError: Button? = null
|
||||
private var tvTitle: TextView? = null
|
||||
private var tvContent: TextView? = null
|
||||
private var tvButtonContent: TextView? = null
|
||||
private var tvLastContent: TextView? = null
|
||||
|
||||
private lateinit var layoutInflater: View
|
||||
private var authorizeController: AuthorizeController? = null
|
||||
|
||||
fun getLayoutView(): View {
|
||||
layoutInflater = LayoutInflater.from(AbsMogoApplication.getApp().applicationContext).inflate(getLayoutId(), null)
|
||||
initViews(layoutInflater)
|
||||
return layoutInflater
|
||||
}
|
||||
|
||||
fun getLayoutId(): Int {
|
||||
return R.layout.module_authorize_fragment
|
||||
}
|
||||
|
||||
fun initViews(mRootView: View) {
|
||||
Logger.d(TAG, "initView ")
|
||||
AnalyticsUtil.track(INVOKE_TRACK_AUTHORIZE_SHOW)
|
||||
init(mRootView)
|
||||
Logger.d(TAG, "invokeTag :$invokeTag")
|
||||
authorizeController = AuthorizeController(invokeTag)
|
||||
invokeAuthorizationContent()
|
||||
VoiceUtil.registerAll(this, this)
|
||||
}
|
||||
|
||||
private fun init(mRootView: View) {
|
||||
clTopParent = mRootView.findViewById(R.id.clAuthorizeTopParent)
|
||||
clErrorContainer = mRootView.findViewById(R.id.clLoadingErrorContainer)
|
||||
clLoadAuthorizeContainer = mRootView.findViewById(R.id.clLoadingAuthorizeContainer)
|
||||
clContainer = mRootView.findViewById(R.id.clAuthorizeContainer)
|
||||
clAuthorizeLoading = mRootView.findViewById(R.id.clAuthorizeLoading)
|
||||
btnAgree = mRootView.findViewById(R.id.btnAuthorizeAgree)
|
||||
btnDisAgree = mRootView.findViewById(R.id.btnAuthorizeDisAgree)
|
||||
btnLoadingError = mRootView.findViewById(R.id.btnAuthorizeLoadingError)
|
||||
tvTitle = mRootView.findViewById(R.id.tvAuthorizeTitle)
|
||||
tvContent = mRootView.findViewById(R.id.tvAuthorizeContent)
|
||||
tvButtonContent = mRootView.findViewById(R.id.tvAuthorizeButtonContent)
|
||||
tvLastContent = mRootView.findViewById(R.id.tvAuthorizeLastContent)
|
||||
btnAgree?.setOnClickListener(this)
|
||||
btnDisAgree?.setOnClickListener(this)
|
||||
btnLoadingError?.setOnClickListener(this)
|
||||
clTopParent?.setOnClickListener(this)
|
||||
clContainer?.setOnClickListener(this)
|
||||
clErrorContainer?.setOnClickListener(this)
|
||||
clLoadAuthorizeContainer?.setOnClickListener(this)
|
||||
clAuthorizeLoading?.setOnClickListener(this)
|
||||
}
|
||||
|
||||
private fun readyToAuthorize() {
|
||||
clErrorContainer?.visibility = View.GONE
|
||||
clLoadAuthorizeContainer?.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
private fun showAuthorizationAgreementContent(
|
||||
agreementId: Long,
|
||||
agreementContent: String,
|
||||
agreementTitle: String,
|
||||
agreementBottom: String,
|
||||
agreementLast: String) {
|
||||
VoiceUtil.speak(AbsMogoApplication.getApp().applicationContext.resources.getString(R.string.module_authorize_agreement_tip), AbsMogoApplication.getApp().applicationContext, this)
|
||||
this.agreementId = agreementId
|
||||
clLoadAuthorizeContainer?.visibility = View.GONE
|
||||
clContainer?.visibility = View.VISIBLE
|
||||
tvTitle?.text = Html.fromHtml(agreementTitle)
|
||||
GlobalScope.async(Dispatchers.IO) {
|
||||
val spannable = Html.fromHtml(agreementContent)
|
||||
withContext(Dispatchers.Main) {
|
||||
tvContent?.text = spannable
|
||||
}
|
||||
}
|
||||
tvButtonContent?.text = Html.fromHtml(agreementBottom)
|
||||
tvLastContent?.text = Html.fromHtml(agreementLast)
|
||||
}
|
||||
|
||||
private fun showAuthorizationError() {
|
||||
clLoadAuthorizeContainer?.visibility = View.GONE
|
||||
clErrorContainer?.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
private fun voiceAuthorizeError() {
|
||||
VoiceUtil.speak(AbsMogoApplication.getApp().applicationContext.getString(R.string.module_authorize_failed), AbsMogoApplication.getApp().applicationContext, this)
|
||||
Logger.d(TAG, "onDestroy")
|
||||
VoiceUtil.unregisterAll(AbsMogoApplication.getApp().applicationContext, this)
|
||||
}
|
||||
|
||||
override fun onClick(v: View) {
|
||||
when (v.id) {
|
||||
R.id.btnAuthorizeAgree -> {
|
||||
AnalyticsUtil.track(INVOKE_TRACK_AUTHORIZE_CLICK, hashMapOf("operation_type" to 1, "operation_result" to 1))
|
||||
agreeAuthorize()
|
||||
}
|
||||
R.id.btnAuthorizeDisAgree -> {
|
||||
AnalyticsUtil.track(INVOKE_TRACK_AUTHORIZE_CLICK, hashMapOf("operation_type" to 1, "operation_result" to 2))
|
||||
disAgreeAuthorize()
|
||||
}
|
||||
R.id.clLoadingErrorContainer, R.id.btnAuthorizeLoadingError -> {
|
||||
invokeAuthorizationContent()
|
||||
}
|
||||
R.id.clAuthorizeTopParent-> {
|
||||
Logger.i(TAG,"dismiss authorizeView")
|
||||
authorizeController?.onDestroy()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onVoiceCmdAgree() {
|
||||
AnalyticsUtil.track(INVOKE_TRACK_AUTHORIZE_CLICK, hashMapOf("operation_type" to 2, "operation_result" to 1))
|
||||
agreeAuthorize()
|
||||
}
|
||||
|
||||
override fun onVoiceCmdDisAgree() {
|
||||
AnalyticsUtil.track(INVOKE_TRACK_AUTHORIZE_CLICK, hashMapOf("operation_type" to 2, "operation_result" to 2))
|
||||
disAgreeAuthorize()
|
||||
}
|
||||
|
||||
private fun agreeAuthorize() {
|
||||
authorizeController?.agreeAuthorize(invokeTag, agreementId) {
|
||||
voiceAuthorizeError()
|
||||
}
|
||||
}
|
||||
|
||||
private fun disAgreeAuthorize() {
|
||||
authorizeController?.disAgreeAuthorize(invokeTag, agreementId) {
|
||||
voiceAuthorizeError()
|
||||
}
|
||||
}
|
||||
|
||||
private fun invokeAuthorizationContent() {
|
||||
authorizeController?.invokeAuthorizationContent(invokeTag, {
|
||||
readyToAuthorize()
|
||||
}, { id: Long, content: String, title: String, bottomContent: String, lastContent: String ->
|
||||
showAuthorizationAgreementContent(id, content, title, bottomContent, lastContent)
|
||||
}, {
|
||||
showAuthorizationError()
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
@@ -21,7 +21,7 @@ data class AgreementStatus(val agreementStatus:Int)
|
||||
|
||||
data class AgreementData(val agreement: Agreement)
|
||||
|
||||
data class Agreement(var tUserAgreementEntity: TUserAgreementEntity, var agreementContent: List<String>)
|
||||
data class Agreement(var tUserAgreementEntity: TUserAgreementEntity, var agreementContent: List<String>?)
|
||||
|
||||
data class TUserAgreementEntity(
|
||||
val id: Long, //协议ID
|
||||
|
||||
@@ -62,7 +62,7 @@ class Request<T> {
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
if (e == null) {
|
||||
if (e.message == null) {
|
||||
onError?.invoke(NULL_EXCEPTION)
|
||||
return@launch
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.util.*
|
||||
|
||||
object DateUtil {
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
fun parseDateToTime(tmpDate: String): Long {
|
||||
val time = Date(tmpDate)
|
||||
return time.time
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.mogo.module.authorize.util
|
||||
|
||||
import android.os.Build
|
||||
import android.text.Html
|
||||
import android.text.Spanned
|
||||
|
||||
class HtmlUtil {
|
||||
|
||||
companion object{
|
||||
fun getSpanned(content: String): Spanned {
|
||||
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
Html.fromHtml(content, Html.FROM_HTML_MODE_LEGACY)
|
||||
} else {
|
||||
@Suppress("DEPRECATION")
|
||||
Html.fromHtml(content)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
package com.mogo.module.authorize.view
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Canvas
|
||||
import android.graphics.Paint
|
||||
import android.util.AttributeSet
|
||||
import android.widget.TextView
|
||||
|
||||
class AutoSplitTextView : TextView {
|
||||
|
||||
private var textShowWidth: Float = 0f
|
||||
private var paint: Paint? = null
|
||||
|
||||
constructor(context: Context?) : super(context, null)
|
||||
constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs) {
|
||||
init()
|
||||
}
|
||||
|
||||
constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr) {
|
||||
init()
|
||||
}
|
||||
|
||||
private fun init() {
|
||||
paint = Paint()
|
||||
}
|
||||
|
||||
|
||||
override fun onDraw(canvas: Canvas) {
|
||||
super.onDraw(canvas)
|
||||
textShowWidth = (this.measuredWidth - paddingLeft - paddingRight).toFloat()
|
||||
var lineCount = 0
|
||||
if (text.toString().isNullOrBlank()) return
|
||||
val textCharArray = text.toString().toCharArray()
|
||||
var drawWidth = 0f
|
||||
var charWidth: Float
|
||||
for (i in 0..textCharArray.size) {
|
||||
charWidth = paint!!.measureText(textCharArray, i, 1)
|
||||
if (textCharArray[i] == '\n') {
|
||||
lineCount++
|
||||
drawWidth = 0f
|
||||
continue
|
||||
}
|
||||
if (textShowWidth - drawWidth < charWidth) {
|
||||
lineCount++
|
||||
drawWidth = 0f
|
||||
}
|
||||
canvas.drawText(textCharArray, i, 1, paddingLeft + drawWidth, (lineCount + 1) * textSize, paint)
|
||||
drawWidth += charWidth
|
||||
}
|
||||
height = (lineCount + 1) * textSize as Int
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,7 +11,7 @@ interface IVoiceAuthorizeIntentListener : IMogoIntentListener, IVoiceBusinessLis
|
||||
override fun onIntentReceived(cmd: String?, intent: Intent?) {
|
||||
Logger.i(IVoiceIntentTAG, "cmd -> $cmd")
|
||||
if (intent != null && cmd != null) {
|
||||
VoiceManager.handleOnIntentCmd(cmd, intent, this)
|
||||
VoiceManager.handleOnIntentCmd(cmd,this)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ object VoiceManager {
|
||||
}
|
||||
}
|
||||
|
||||
fun handleOnIntentCmd(cmd: String, intent: Intent, listener: IVoiceAuthorizeIntentListener) {
|
||||
fun handleOnIntentCmd(cmd: String, listener: IVoiceAuthorizeIntentListener) {
|
||||
Logger.i(TAG, "handleOnIntentCmd: cmd -> $cmd")
|
||||
when (cmd) {
|
||||
VOICE_INTENT_AGREE -> {
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.mogo.module.common.entity;
|
||||
|
||||
import com.mogo.map.MogoLatLng;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class RoadTrafficSegment {
|
||||
|
||||
//道路拥堵信息分级
|
||||
private int status;
|
||||
|
||||
//分段道路拥堵经纬度点
|
||||
private List<MogoLatLng> mogoLatLngList;
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(int status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public List<MogoLatLng> getMogoLatLngList() {
|
||||
return mogoLatLngList;
|
||||
}
|
||||
|
||||
public void setMogoLatLngList(List<MogoLatLng> mogoLatLngList) {
|
||||
this.mogoLatLngList = mogoLatLngList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "RoadTrafficSegment{" +
|
||||
"status=" + status +
|
||||
", mogoLatLngList=" + mogoLatLngList +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
package com.mogo.module.common.entity;
|
||||
|
||||
import com.mogo.map.MogoLatLng;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 交通路况信息
|
||||
*/
|
||||
public class RoadTrafficStatus {
|
||||
|
||||
//角度
|
||||
private int angle;
|
||||
|
||||
//行车信息描述
|
||||
private String direction;
|
||||
|
||||
//道路名称
|
||||
private String roadName;
|
||||
|
||||
//道路拥堵信息分级
|
||||
private int status;
|
||||
|
||||
//道路拥堵长度
|
||||
private int length;
|
||||
|
||||
//整条道路拥堵经纬度点
|
||||
private List<MogoLatLng> mogoLatLngList;
|
||||
|
||||
//是否存在道路分段数据
|
||||
private boolean segment;
|
||||
|
||||
//分段道路数据
|
||||
private List<RoadTrafficSegment> roadTrafficSegmentList;
|
||||
|
||||
public int getAngle() {
|
||||
return angle;
|
||||
}
|
||||
|
||||
public void setAngle(int angle) {
|
||||
this.angle = angle;
|
||||
}
|
||||
|
||||
public String getDirection() {
|
||||
return direction;
|
||||
}
|
||||
|
||||
public void setDirection(String direction) {
|
||||
this.direction = direction;
|
||||
}
|
||||
|
||||
public String getRoadName() {
|
||||
return roadName;
|
||||
}
|
||||
|
||||
public void setRoadName(String roadName) {
|
||||
this.roadName = roadName;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(int status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public int getLength() {
|
||||
return length;
|
||||
}
|
||||
|
||||
public void setLength(int length) {
|
||||
this.length = length;
|
||||
}
|
||||
|
||||
public List<MogoLatLng> getMogoLatLngList() {
|
||||
return mogoLatLngList;
|
||||
}
|
||||
|
||||
public void setMogoLatLngList(List<MogoLatLng> mogoLatLngList) {
|
||||
this.mogoLatLngList = mogoLatLngList;
|
||||
}
|
||||
|
||||
public boolean isSegment() {
|
||||
return segment;
|
||||
}
|
||||
|
||||
public void setSegment(boolean segment) {
|
||||
this.segment = segment;
|
||||
}
|
||||
|
||||
public List<RoadTrafficSegment> getRoadTrafficSegmentList() {
|
||||
return roadTrafficSegmentList;
|
||||
}
|
||||
|
||||
public void setRoadTrafficSegmentList(List<RoadTrafficSegment> roadTrafficSegmentList) {
|
||||
this.roadTrafficSegmentList = roadTrafficSegmentList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "RoadTrafficStatus{" +
|
||||
"angle=" + angle +
|
||||
", direction='" + direction + '\'' +
|
||||
", roadName='" + roadName + '\'' +
|
||||
", status=" + status +
|
||||
", length=" + length +
|
||||
", mogoLatLngList=" + mogoLatLngList +
|
||||
", segment=" + segment +
|
||||
", roadTrafficSegmentList=" + roadTrafficSegmentList +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.mogo.module.common.entity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 上报路况服务Entity
|
||||
*/
|
||||
public class UploadTrafficEntity {
|
||||
|
||||
private List<RoadTrafficStatus> roadTrafficStatuses;
|
||||
|
||||
public List<RoadTrafficStatus> getRoadTrafficStatuses() {
|
||||
return roadTrafficStatuses;
|
||||
}
|
||||
|
||||
public void setRoadTrafficStatuses(List<RoadTrafficStatus> roadTrafficStatuses) {
|
||||
this.roadTrafficStatuses = roadTrafficStatuses;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "UploadTrafficEntity{" +
|
||||
"roadTrafficStatuses=" + roadTrafficStatuses +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -82,4 +82,16 @@ public class PoiWrapper {
|
||||
public void setIconInfoUrl(String iconInfoUrl) {
|
||||
this.iconInfoUrl = iconInfoUrl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PoiWrapper{" +
|
||||
"poiType='" + poiType + '\'' +
|
||||
", iconRes=" + iconRes +
|
||||
", iconInfoRes=" + iconInfoRes +
|
||||
", iconUrl='" + iconUrl + '\'' +
|
||||
", iconInfoUrl='" + iconInfoUrl + '\'' +
|
||||
", title='" + title + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,6 +80,7 @@ public class CloudPoiManager {
|
||||
String config = SharedPrefsMgr.getInstance(context).getString("SHARE_BUTTON_CONFIG", "");
|
||||
if (!config.isEmpty()) {
|
||||
List<PoiWrapper> configWrappers = GsonUtil.arrayFromJson(config, PoiWrapper.class);
|
||||
Logger.d(TAG, "config: " + configWrappers);
|
||||
if(configWrappers!=null) {
|
||||
for (PoiWrapper wrapper : configWrappers) {
|
||||
wrapper.setIconInfoRes(R.drawable.module_common_icon_map_marker_road_block_up2_white);
|
||||
@@ -91,6 +92,7 @@ public class CloudPoiManager {
|
||||
wrapper.setIconInfoRes(defWrapper.getIconInfoRes());
|
||||
}
|
||||
}
|
||||
Logger.d(TAG, "put===" + wrapper);
|
||||
poiWrapper.put(wrapper.getPoiType(), wrapper);
|
||||
}
|
||||
}else{
|
||||
|
||||
@@ -230,7 +230,6 @@ public class CustomRatingBar extends LinearLayout {
|
||||
layout.setMargins(0, 0, Math.round(elementPadding), 0);//设置每颗星星在线性布局的间距
|
||||
imageView.setLayoutParams(layout);
|
||||
imageView.setAdjustViewBounds(true);
|
||||
imageView.setScaleType(ImageView.ScaleType.FIT_XY);
|
||||
imageView.setImageDrawable(elementEmptyDrawable);
|
||||
imageView.setMinimumWidth((int) elementWidth);
|
||||
imageView.setMaxWidth((int) elementWidth);
|
||||
|
||||
@@ -37,8 +37,7 @@ class PushRepository(mContext: Context) {
|
||||
PushRepository(appContext)
|
||||
}
|
||||
|
||||
@JvmField
|
||||
val TAG: String = "PushRepository.kt"
|
||||
private const val TAG: String = "PushRepository.kt"
|
||||
}
|
||||
|
||||
// 被中断的push消息仅再次展示一次
|
||||
@@ -74,13 +73,13 @@ class PushRepository(mContext: Context) {
|
||||
Log.d("PushRepository", "pushBean = $bean")
|
||||
if (bean != null) {
|
||||
AnalyticsUtils.track(Config.NEWS_ARRIVE, "title", bean.title)
|
||||
if (bean.mainSchema == null || bean.mainSchema == "") {
|
||||
if (bean.mainSchema.isBlank()) {
|
||||
bean.mainSchema = ""
|
||||
}
|
||||
if (bean.imageUrl == null || bean.imageUrl == "null") {
|
||||
if (bean.imageUrl.isBlank()) {
|
||||
bean.imageUrl = ""
|
||||
}
|
||||
if (bean.appIcon == null || bean.appIcon == "null") {
|
||||
if (bean.appIcon.isBlank()) {
|
||||
bean.appIcon = ""
|
||||
}
|
||||
pushBeanQueue.offer(bean)
|
||||
@@ -144,10 +143,7 @@ class PushRepository(mContext: Context) {
|
||||
startIterate()
|
||||
}
|
||||
|
||||
private inline fun needDelay(bean: PushBean): Boolean {
|
||||
if (bean == null) {
|
||||
return false
|
||||
}
|
||||
private fun needDelay(bean: PushBean): Boolean {
|
||||
if (locationClient.lastKnowLocation != null) {
|
||||
if (bean.speedLimit > 0 && bean.speedLimit <= locationClient.lastKnowLocation.speed * 18 / 5) {
|
||||
Log.d("PushRepository", "speedLimit" + locationClient.lastKnowLocation.speed)
|
||||
|
||||
@@ -6,12 +6,12 @@ import androidx.core.view.get
|
||||
import androidx.core.view.isNotEmpty
|
||||
import com.mogo.utils.logger.Logger
|
||||
|
||||
val TAG: String = "AnimatorUtils.kt"
|
||||
const val TAG: String = "AnimatorUtils.kt"
|
||||
|
||||
fun startClearAnimator(root: ViewGroup, runnable: Runnable) {
|
||||
if (root.isNotEmpty()) {
|
||||
var view: View
|
||||
var size = root.childCount - 1
|
||||
val size = root.childCount - 1
|
||||
for (i in size downTo 0) {
|
||||
view = root[i]
|
||||
view.animate().translationX(-view.width.toFloat()).apply {
|
||||
@@ -27,7 +27,7 @@ fun startClearAnimator(root: ViewGroup, runnable: Runnable) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
runnable?.apply {
|
||||
runnable.apply {
|
||||
run()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ class FloatView constructor(
|
||||
fun inflateView(@LayoutRes layoutId: Int)
|
||||
}
|
||||
|
||||
open abstract inner class PushView(context: Context) : FrameLayout(context),
|
||||
abstract inner class PushView(context: Context) : FrameLayout(context),
|
||||
PushViewController {
|
||||
lateinit var appIcon: ImageView
|
||||
lateinit var titleIconContainer: View
|
||||
@@ -95,7 +95,7 @@ class FloatView constructor(
|
||||
|
||||
fun hasButtons(bean: PushBean?): Boolean {
|
||||
bean?.buttons?.forEach {
|
||||
if (!it?.text?.isNullOrEmpty()) {
|
||||
if (!it.text?.isNullOrEmpty()) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import android.util.Log
|
||||
import com.mogo.commons.voice.AIAssist
|
||||
import com.mogo.commons.voice.IMogoVoiceCmdCallBack
|
||||
import com.mogo.module.push.Config
|
||||
import com.zhidao.auto.platform.voice.VoiceClient
|
||||
import com.mogo.module.push.model.PushBean
|
||||
import com.mogo.module.push.repository.PushRepository
|
||||
import com.mogo.module.push.utils.AnalyticsUtils
|
||||
@@ -119,8 +118,8 @@ class PushViewModel(
|
||||
}
|
||||
field?.showTimeoutShadow = field?.showTimeout?:0
|
||||
Log.d("yilz", "pushbean = $value")
|
||||
if (value != null && value!!.imageUrl == null) {
|
||||
value!!.imageUrl = ""
|
||||
if (value.imageUrl.isBlank()) {
|
||||
value.imageUrl = ""
|
||||
}
|
||||
if (floatView == null) {
|
||||
floatView = FloatView(this, mContext)
|
||||
|
||||
@@ -49,41 +49,41 @@ object SettingManager : IMogoSettingManager {
|
||||
private var isGpsSimulator: Boolean = false
|
||||
|
||||
override fun getPathPrefer(): Int {
|
||||
return settings!!.getInt(KEY_PAHT_PREFER, 0)
|
||||
return settings.getInt(KEY_PAHT_PREFER, 0)
|
||||
}
|
||||
|
||||
override fun getVolume(): Int {
|
||||
return settings!!.getInt(KEY_VOLUME, 0)
|
||||
return settings.getInt(KEY_VOLUME, 0)
|
||||
}
|
||||
|
||||
override fun getVoiceStyle(): Int {
|
||||
return settings!!.getInt(KEY_VOICE_STYLE, R.id.rb_navi_detail)
|
||||
return settings.getInt(KEY_VOICE_STYLE, R.id.rb_navi_detail)
|
||||
}
|
||||
|
||||
override fun getMapType(): Int {
|
||||
return settings!!.getInt(KEY_MAP_TYPE, R.id.rb_navi_day)
|
||||
return settings.getInt(KEY_MAP_TYPE, R.id.rb_navi_day)
|
||||
}
|
||||
|
||||
fun setPathPrefer(type: Int) {
|
||||
settings!!.edit()
|
||||
settings.edit()
|
||||
.putInt(KEY_PAHT_PREFER, type)
|
||||
.apply()
|
||||
}
|
||||
|
||||
fun setVolume(type: Int) {
|
||||
settings!!.edit()
|
||||
settings.edit()
|
||||
.putInt(KEY_VOLUME, type)
|
||||
.apply()
|
||||
}
|
||||
|
||||
fun setVoiceStyle(type: Int) {
|
||||
settings!!.edit()
|
||||
settings.edit()
|
||||
.putInt(KEY_VOICE_STYLE, type)
|
||||
.apply()
|
||||
}
|
||||
|
||||
fun setMapType(type: Int) {
|
||||
settings!!.edit()
|
||||
settings.edit()
|
||||
.putInt(KEY_MAP_TYPE, type)
|
||||
.apply()
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ import com.mogo.module.common.map.Scene
|
||||
import com.mogo.module.common.utils.CarSeries
|
||||
import com.mogo.module.navi.R
|
||||
import com.mogo.module.navi.constants.SearchApisHolder
|
||||
import com.mogo.module.navi.manager.AddressManager
|
||||
import com.mogo.module.navi.ui.adapter.SearchCategoryAdapter
|
||||
import com.mogo.module.navi.ui.base.BaseFragment
|
||||
import com.mogo.module.navi.uitls.BitmapUtils
|
||||
@@ -34,17 +33,16 @@ class CategorySearchFragment : BaseFragment(), CategoryView, IMogoVoiceCmdCallBa
|
||||
|
||||
override fun onCmdSelected(cmd: String?) {
|
||||
if (cmd?.startsWith("position") == true) {
|
||||
var index = cmd.substring(8)
|
||||
val index = cmd.substring(8)
|
||||
mAdapter.current = index.toInt()
|
||||
updateMarker(false)
|
||||
goPath()
|
||||
}
|
||||
}
|
||||
|
||||
private val TAG: String = "CategorySearchFragment"
|
||||
private var addMarkers: ArrayList<IMogoMarker> = ArrayList()
|
||||
var arrayList = ArrayList<MogoMarkerOptions>()
|
||||
var locationList = ArrayList<MogoLatLng>()
|
||||
private var arrayList = ArrayList<MogoMarkerOptions>()
|
||||
private var locationList = ArrayList<MogoLatLng>()
|
||||
|
||||
private lateinit var cmds: ArrayList<String>
|
||||
|
||||
@@ -57,13 +55,13 @@ class CategorySearchFragment : BaseFragment(), CategoryView, IMogoVoiceCmdCallBa
|
||||
arrayList.clear()
|
||||
locationList.clear()
|
||||
|
||||
for (index in 0 until datums!!.size) {
|
||||
var decodeResource = BitmapFactory.decodeResource(
|
||||
for (index in datums!!.indices) {
|
||||
val decodeResource = BitmapFactory.decodeResource(
|
||||
resources,
|
||||
if (mAdapter.current == index) R.mipmap.icon_search_category_checked else R.mipmap.icon_search_category_unchecked
|
||||
)
|
||||
|
||||
var createWaterMask = BitmapUtils.createWaterMask(
|
||||
val createWaterMask = BitmapUtils.createWaterMask(
|
||||
context,
|
||||
decodeResource,
|
||||
(index + 1).toString(),
|
||||
@@ -76,15 +74,15 @@ class CategorySearchFragment : BaseFragment(), CategoryView, IMogoVoiceCmdCallBa
|
||||
.owner("CategorySearchFragment")
|
||||
.`object`(index)
|
||||
// .anchor(0.5f, 1f)
|
||||
.longitude(datums[index].point?.lng ?: 0.0)
|
||||
.longitude(datums[index].point?.lon ?: 0.0)
|
||||
arrayList.add(options)
|
||||
if (locationList.size < 3) {
|
||||
locationList.add(datums[index].point)
|
||||
}
|
||||
|
||||
var int2String = StringUtils.int2String(index + 1)
|
||||
val int2String = StringUtils.int2String(index + 1)
|
||||
AIAssist.getInstance(context).registerUnWakeupCommand("position${index}", arrayOf("第${int2String}个", "第${int2String}条"), this)
|
||||
cmds.add("position" + index)
|
||||
cmds.add("position$index")
|
||||
|
||||
}
|
||||
addMarkers()
|
||||
@@ -92,7 +90,7 @@ class CategorySearchFragment : BaseFragment(), CategoryView, IMogoVoiceCmdCallBa
|
||||
|
||||
private fun addMarkers() {
|
||||
addMarkers.clear()
|
||||
var marginBounder = resources.getDimensionPixelSize(R.dimen.dp_60) * 2
|
||||
val marginBounder = resources.getDimensionPixelSize(R.dimen.dp_60) * 2
|
||||
SearchApisHolder.getUiControllerApis().showBounds(TAG,
|
||||
locationList[0],
|
||||
locationList,
|
||||
@@ -101,7 +99,7 @@ class CategorySearchFragment : BaseFragment(), CategoryView, IMogoVoiceCmdCallBa
|
||||
)
|
||||
|
||||
for (options in arrayList) {
|
||||
var addMarker = SearchApisHolder.getMarkerManager().addMarker(TAG, options)
|
||||
val addMarker = SearchApisHolder.getMarkerManager().addMarker(TAG, options)
|
||||
addMarker.onMarkerClickListener = this
|
||||
addMarkers.add(addMarker)
|
||||
}
|
||||
@@ -109,7 +107,7 @@ class CategorySearchFragment : BaseFragment(), CategoryView, IMogoVoiceCmdCallBa
|
||||
|
||||
private fun registerVoice() {
|
||||
for (index in 0 until cmds.size) {
|
||||
var int2String = StringUtils.int2String(index + 1)
|
||||
val int2String = StringUtils.int2String(index + 1)
|
||||
AIAssist.getInstance(context).registerUnWakeupCommand("position${index}", arrayOf("第${int2String}个", "第${int2String}条"), this)
|
||||
}
|
||||
}
|
||||
@@ -125,7 +123,7 @@ class CategorySearchFragment : BaseFragment(), CategoryView, IMogoVoiceCmdCallBa
|
||||
}
|
||||
|
||||
override fun onMarkerClicked(marker: IMogoMarker?): Boolean {
|
||||
var index = marker?.mogoMarkerOptions?.`object` as Int
|
||||
val index = marker?.mogoMarkerOptions?.`object` as Int
|
||||
mAdapter.current = index
|
||||
rv_search_result.smoothScrollToPosition(index)
|
||||
updateMarker()
|
||||
@@ -142,7 +140,7 @@ class CategorySearchFragment : BaseFragment(), CategoryView, IMogoVoiceCmdCallBa
|
||||
category = arguments?.getString("category")
|
||||
mSearchPresenter = CategoryPresenter(this)
|
||||
lifecycle.addObserver(mSearchPresenter)
|
||||
cmds = ArrayList<String>()
|
||||
cmds = ArrayList()
|
||||
}
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
@@ -168,7 +166,7 @@ class CategorySearchFragment : BaseFragment(), CategoryView, IMogoVoiceCmdCallBa
|
||||
goPath()
|
||||
}
|
||||
mAdapter.setOnClickListener {
|
||||
var position = it.getTag(R.id.tag_position) as Int
|
||||
val position = it.getTag(R.id.tag_position) as Int
|
||||
mAdapter.current = position
|
||||
updateMarker()
|
||||
}
|
||||
@@ -183,13 +181,12 @@ class CategorySearchFragment : BaseFragment(), CategoryView, IMogoVoiceCmdCallBa
|
||||
}
|
||||
|
||||
private fun updateMarker(moveToCenter: Boolean = true) {
|
||||
|
||||
addMarkers?.get(mAdapter.lastPosition)?.setIcon(getMarkerIcon(mAdapter.lastPosition))
|
||||
var current = addMarkers?.get(mAdapter.current)
|
||||
current?.setIcon(getMarkerIcon(mAdapter.current))
|
||||
current?.setToTop()
|
||||
arrayList.get(mAdapter.lastPosition).icon(getMarkerIcon(mAdapter.lastPosition))
|
||||
arrayList.get(mAdapter.current).icon(getMarkerIcon(mAdapter.current))
|
||||
addMarkers[mAdapter.lastPosition].setIcon(getMarkerIcon(mAdapter.lastPosition))
|
||||
val current = addMarkers[mAdapter.current]
|
||||
current.setIcon(getMarkerIcon(mAdapter.current))
|
||||
current.setToTop()
|
||||
arrayList[mAdapter.lastPosition].icon(getMarkerIcon(mAdapter.lastPosition))
|
||||
arrayList[mAdapter.current].icon(getMarkerIcon(mAdapter.current))
|
||||
if (moveToCenter) {
|
||||
SearchApisHolder.getStatusManager().setUserInteractionStatus(TAG, true, false)
|
||||
SearchApisHolder.getUiControllerApis().moveToCenter(current.position, CarSeries.CAR_SERIES_F80X == CarSeries.getSeries())
|
||||
@@ -197,7 +194,7 @@ class CategorySearchFragment : BaseFragment(), CategoryView, IMogoVoiceCmdCallBa
|
||||
}
|
||||
|
||||
private fun getMarkerIcon(index: Int): Bitmap {
|
||||
var decodeResource = BitmapFactory.decodeResource(
|
||||
val decodeResource = BitmapFactory.decodeResource(
|
||||
resources,
|
||||
if (mAdapter.current == index) R.mipmap.icon_search_category_checked else R.mipmap.icon_search_category_unchecked
|
||||
)
|
||||
@@ -232,13 +229,16 @@ class CategorySearchFragment : BaseFragment(), CategoryView, IMogoVoiceCmdCallBa
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
private const val TAG: String = "CategorySearchFragment"
|
||||
|
||||
fun newInstance(category: String): Fragment {
|
||||
MapCenterPointStrategy.setMapCenterPointByScene(SearchApisHolder.getUiControllerApis(), Scene.CATEGORY_SEARCH)
|
||||
var bundle = Bundle()
|
||||
val bundle = Bundle()
|
||||
bundle.putString("category", category)
|
||||
var categorySerachFragment = CategorySearchFragment()
|
||||
categorySerachFragment.arguments = bundle
|
||||
return categorySerachFragment
|
||||
val categorySearchFragment = CategorySearchFragment()
|
||||
categorySearchFragment.arguments = bundle
|
||||
return categorySearchFragment
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
package com.mogo.module.share;
|
||||
|
||||
import android.content.Context;
|
||||
import android.nfc.Tag;
|
||||
import android.util.Log;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
import com.amap.api.services.nearby.UploadInfoCallback;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.navi.IMogoAimlessModeListener;
|
||||
import com.mogo.map.navi.MogoCongestionInfo;
|
||||
import com.mogo.map.navi.MogoCongestionLink;
|
||||
import com.mogo.map.navi.MogoTraffic;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.entity.RoadTrafficSegment;
|
||||
import com.mogo.module.common.entity.RoadTrafficStatus;
|
||||
import com.mogo.module.common.entity.UploadTrafficEntity;
|
||||
import com.mogo.module.share.net.TrafficModelData;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* TODO 高德巡航信息监听,并将拥堵信息上报到服务端
|
||||
*/
|
||||
@Route(path = MogoServicePaths.PATH_GAODE_AIMLESS_SHARE)
|
||||
public class GaoDeAimlessProvider implements IProvider {
|
||||
private final String TAG = "GaoDeAimlessProvider";
|
||||
private TrafficModelData mTanluModelData;
|
||||
List<RoadTrafficSegment> mlist = new ArrayList<>();
|
||||
RoadTrafficSegment roadTrafficSegment = new RoadTrafficSegment();
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
|
||||
Log.d(TAG, "provider init……");
|
||||
if (mTanluModelData == null) {
|
||||
mTanluModelData = new TrafficModelData();
|
||||
}
|
||||
|
||||
// 开启巡航监听
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getMapServiceApi()
|
||||
.getAimless(context)
|
||||
.setAimlessModeStatus(true);
|
||||
|
||||
// 注册高德巡航回调
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getRegisterCenterApi()
|
||||
.registerMogoAimlessModeListener(TAG, new IMogoAimlessModeListener() {
|
||||
@Override
|
||||
public void onUpdateTraffic2(MogoTraffic traffic) {
|
||||
Log.d(TAG, "onUpdateTraffic2 back……");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdateCongestion(MogoCongestionInfo info) {
|
||||
Log.d(TAG, GsonUtil.jsonFromObject(info));
|
||||
UploadInfo(info);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 上报拥堵信息
|
||||
*
|
||||
* @param info
|
||||
*/
|
||||
private void UploadInfo(MogoCongestionInfo info) {
|
||||
UploadTrafficEntity uploadTrafficEntity = new UploadTrafficEntity();
|
||||
List<RoadTrafficStatus> roadTrafficStatusList = new ArrayList<>();
|
||||
RoadTrafficStatus mStatusBean = new RoadTrafficStatus();
|
||||
mStatusBean.setLength(info.getLength());
|
||||
mStatusBean.setRoadName(info.getRoadName());
|
||||
mStatusBean.setStatus(info.getCongestionStatus());
|
||||
mStatusBean.setSegment(true);
|
||||
|
||||
if (info.getCongestionLinks() != null && info.getCongestionLinks().size() > 0) {
|
||||
mlist.clear();
|
||||
for (MogoCongestionLink data : info.getCongestionLinks()
|
||||
) {
|
||||
roadTrafficSegment.setStatus(data.getCongestionStatus());
|
||||
roadTrafficSegment.setMogoLatLngList(data.getCoords());
|
||||
mlist.add(roadTrafficSegment);
|
||||
}
|
||||
mStatusBean.setRoadTrafficSegmentList(mlist);
|
||||
}
|
||||
roadTrafficStatusList.add(mStatusBean);
|
||||
uploadTrafficEntity.setRoadTrafficStatuses(roadTrafficStatusList);
|
||||
mTanluModelData.uploadTrafficInfo(uploadTrafficEntity);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.map.navi.IMogoAimless;
|
||||
import com.mogo.map.search.poisearch.IMogoPoiSearch;
|
||||
import com.mogo.map.search.poisearch.query.MogoPoiSearchQuery;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
@@ -31,6 +32,7 @@ public class TanluServiceManager {
|
||||
private static IMogoIntentManager mogoIntentManager;
|
||||
private static IMogoRegisterCenter mogoRegisterCenter;
|
||||
private static IMogoTopViewManager mIMogoTopViewManager;
|
||||
private static IMogoAimless mIMogoAimless;
|
||||
|
||||
public static void init(Context context) {
|
||||
mServiceApis = (IMogoServiceApis) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(context);
|
||||
@@ -39,6 +41,7 @@ public class TanluServiceManager {
|
||||
mAnalytics = mServiceApis.getAnalyticsApi();
|
||||
mogoIntentManager = mServiceApis.getIntentManagerApi();
|
||||
mogoRegisterCenter = mServiceApis.getRegisterCenterApi();
|
||||
mIMogoAimless = mMapService.getAimless(context);
|
||||
|
||||
mIMogoTopViewManager = mServiceApis.getTopViewManager();
|
||||
mPoiSearch = mMapService.getPoiSearch(context, new MogoPoiSearchQuery());
|
||||
@@ -81,4 +84,7 @@ public class TanluServiceManager {
|
||||
return mServiceApis;
|
||||
}
|
||||
|
||||
public static IMogoAimless getMogoAimless() {
|
||||
return mIMogoAimless;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package com.mogo.module.share
|
||||
|
||||
import android.content.Context
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.alibaba.android.arouter.facade.template.IProvider
|
||||
import com.mogo.module.share.manager.TrafficUploadManager.Companion.trafficUpload
|
||||
import com.mogo.service.MogoServicePaths
|
||||
import com.mogo.service.share.IMogoTrafficUploadProvider
|
||||
|
||||
@Route( path = MogoServicePaths.PATH_TRAFFIC_UPLOAD )
|
||||
class TrafficUploadProvider :IProvider , IMogoTrafficUploadProvider{
|
||||
|
||||
override fun init(context: Context?) {
|
||||
|
||||
}
|
||||
|
||||
override fun verifyCurrentTrafficStatus() {
|
||||
trafficUpload.verityTrafficStatus()
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,6 +10,11 @@ class HttpConstant {
|
||||
const val HOST_DEMO = "http://dzt-show.zhidaohulian.com"
|
||||
const val HOST_PRODUCT = "https://dzt.zhidaohulian.com"
|
||||
|
||||
const val TMC_HOST_TEST="http://dzt-test.zhidaozhixing.com"
|
||||
const val TMC_HOST_DEMO="http://dzt-show.zhidaozhixing.com"
|
||||
const val TMC_HOST_PRODUCT="http://dzt.zhidaozhixing.com"
|
||||
|
||||
@JvmStatic
|
||||
fun getNetHost(): String {
|
||||
return when (DebugConfig.getNetMode()) {
|
||||
DebugConfig.NET_MODE_DEV -> HOST_DEV
|
||||
@@ -18,6 +23,16 @@ class HttpConstant {
|
||||
else -> HOST_PRODUCT
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun getTMCHost(): String {
|
||||
return when (DebugConfig.getNetMode()) {
|
||||
DebugConfig.NET_MODE_DEV -> TMC_HOST_TEST
|
||||
DebugConfig.NET_MODE_QA -> TMC_HOST_TEST
|
||||
DebugConfig.NET_MODE_DEMO -> TMC_HOST_DEMO
|
||||
else -> TMC_HOST_PRODUCT
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.mogo.module.share.manager
|
||||
|
||||
import com.mogo.map.MogoLatLng
|
||||
import com.mogo.map.search.traffic.IMogoTrafficSearchListener
|
||||
import com.mogo.map.search.traffic.MogoTrafficResult
|
||||
import com.mogo.module.common.MogoApisHandler
|
||||
import com.mogo.module.common.entity.RoadTrafficStatus
|
||||
import com.mogo.module.common.entity.UploadTrafficEntity
|
||||
import com.mogo.module.share.TanluServiceManager
|
||||
import com.mogo.module.share.net.TrafficModelData
|
||||
import com.mogo.utils.logger.Logger
|
||||
import java.util.*
|
||||
|
||||
class TrafficUploadManager : IMogoTrafficSearchListener {
|
||||
|
||||
companion object {
|
||||
|
||||
const val TAG = "TrafficUploadManager"
|
||||
const val TRAFFIC_SEARCH_AREA = 500
|
||||
|
||||
const val TRACK_UPLOAD_INVOKE = "Mogoer_Upload_Traffic_Invoke"
|
||||
|
||||
val trafficUpload by lazy(LazyThreadSafetyMode.SYNCHRONIZED) {
|
||||
TrafficUploadManager()
|
||||
}
|
||||
}
|
||||
|
||||
private val trafficModelData = TrafficModelData()
|
||||
|
||||
fun verityTrafficStatus() {
|
||||
val trafficSearchApi = TanluServiceManager.getMapService().trafficSearchApi
|
||||
val location = TanluServiceManager.getLocationClient().lastKnowLocation
|
||||
trafficSearchApi.registerTrafficSearchListener(this)
|
||||
Logger.d(TAG, "verityTrafficStatus searchTrafficByCircleArea")
|
||||
trafficSearchApi.searchTrafficByCircleArea(MogoLatLng(location.latitude, location.longitude), TRAFFIC_SEARCH_AREA)
|
||||
}
|
||||
|
||||
override fun onTrafficSearchError(errorMsg: String?) {
|
||||
errorMsg?.let {
|
||||
Logger.d(TAG, "onTrafficSearchError errorMsg : $errorMsg , So drop this verity and track")
|
||||
val map = hashMapOf<String, Any>("upload" to 2) //调用高德接口失败
|
||||
MogoApisHandler.getInstance().apis.analyticsApi.track(TRACK_UPLOAD_INVOKE, map)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onTrafficSearchInfo(trafficResult: MogoTrafficResult?) {
|
||||
val map = hashMapOf<String, Any>("upload" to 1) //调用高德接口成功
|
||||
MogoApisHandler.getInstance().apis.analyticsApi.track(TRACK_UPLOAD_INVOKE, map)
|
||||
trafficResult?.let {
|
||||
val uploadTrafficEntity = UploadTrafficEntity()
|
||||
val roadTrafficStatusList: MutableList<RoadTrafficStatus> = ArrayList()
|
||||
val trafficStatusInfoList = it.trafficStatusInfos
|
||||
trafficStatusInfoList.forEach { info ->
|
||||
val roadTrafficStatus = RoadTrafficStatus()
|
||||
roadTrafficStatus.angle = info.angle
|
||||
roadTrafficStatus.direction = info.direction
|
||||
roadTrafficStatus.isSegment = false
|
||||
roadTrafficStatus.length = 0
|
||||
roadTrafficStatus.roadName = info.name
|
||||
roadTrafficStatus.status = info.status.toInt()
|
||||
roadTrafficStatus.mogoLatLngList = info.mogoLatLngs
|
||||
roadTrafficStatusList.add(roadTrafficStatus)
|
||||
}
|
||||
uploadTrafficEntity.roadTrafficStatuses = roadTrafficStatusList
|
||||
trafficModelData.uploadTrafficInfo(uploadTrafficEntity)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,6 @@ import com.mogo.commons.voice.AIAssist
|
||||
import com.mogo.map.MogoLatLng
|
||||
import com.mogo.module.common.entity.MarkerPoiTypeEnum
|
||||
import com.mogo.module.share.R
|
||||
import com.mogo.module.share.TanluManager
|
||||
import com.mogo.module.share.constant.ShareConstants.*
|
||||
import com.mogo.service.share.TanluUploadParams
|
||||
import com.mogo.utils.NetworkUtils
|
||||
@@ -70,10 +69,10 @@ object UploadHelper {
|
||||
|
||||
private fun showVoiceTip(context: Context, type: String) {
|
||||
var shareItemSum = SharedPrefsMgr.getInstance(context).getInt(KEY_CLICK_SHARE_ITEM_BUTTON, 0)
|
||||
var intervalTime = SharedPrefsMgr.getInstance(context).getLong(KEY_CLICK_SHARE_ITEM_TIME, 0)
|
||||
val intervalTime = SharedPrefsMgr.getInstance(context).getLong(KEY_CLICK_SHARE_ITEM_TIME, 0)
|
||||
if (shareItemSum < VOICE_ALERT_COUNT) {
|
||||
Log.d("UploadHelper", "shareItemSum = $shareItemSum --- intervalTime = $intervalTime --type = ${type}")
|
||||
var time = System.currentTimeMillis()
|
||||
val time = System.currentTimeMillis()
|
||||
if (intervalTime == 0.toLong()) {
|
||||
SharedPrefsMgr.getInstance(context).putLong(KEY_CLICK_SHARE_ITEM_TIME, time)
|
||||
SharedPrefsMgr.getInstance(context).putInt(KEY_CLICK_SHARE_ITEM_BUTTON, ++shareItemSum)
|
||||
@@ -93,8 +92,7 @@ object UploadHelper {
|
||||
|
||||
|
||||
private fun getTypeName(type: String): String? {
|
||||
var typeName = ""
|
||||
typeName = when (type) {
|
||||
return when (type) {
|
||||
MarkerPoiTypeEnum.TRAFFIC_CHECK -> "交通检查"
|
||||
MarkerPoiTypeEnum.ROAD_CLOSED -> "封路"
|
||||
MarkerPoiTypeEnum.FOURS_ROAD_WORK -> "施工"
|
||||
@@ -106,7 +104,6 @@ object UploadHelper {
|
||||
MarkerPoiTypeEnum.FOURS_LIVING -> "实时路况"
|
||||
else -> "实时路况"
|
||||
}
|
||||
return typeName
|
||||
}
|
||||
|
||||
}
|
||||
@@ -42,6 +42,6 @@ interface ShareApiService {
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("/yycp-launcherSnapshot/launcherSnapshot/searchRoadEventsSync")
|
||||
fun queryRoadInfos(@FieldMap params: Map<String, Object>): Observable<BaseDataCompat<RoadInfos>>
|
||||
fun queryRoadInfos(@FieldMap params: Map<String, Any>): Observable<BaseDataCompat<RoadInfos>>
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.mogo.module.share.net;
|
||||
|
||||
import com.mogo.commons.data.BaseData;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.FieldMap;
|
||||
import retrofit2.http.FormUrlEncoded;
|
||||
import retrofit2.http.POST;
|
||||
|
||||
public interface TrafficApiService {
|
||||
/**
|
||||
* 上报路况拥堵情况
|
||||
*
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("/yycp-tmcServer/tmcServer/car/reportTraffic/v1")
|
||||
Observable<BaseData> UploadCongestionInfo(@FieldMap Map<String, Object> parames);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.mogo.module.share.net;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.data.BaseData;
|
||||
import com.mogo.commons.network.ParamsProvider;
|
||||
import com.mogo.commons.network.SubscribeImpl;
|
||||
import com.mogo.commons.network.Utils;
|
||||
import com.mogo.module.common.entity.RoadTrafficStatus;
|
||||
import com.mogo.module.common.entity.UploadTrafficEntity;
|
||||
import com.mogo.module.share.constant.HttpConstant;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.network.IMogoNetwork;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.RequestOptions;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
import static com.mogo.commons.AbsMogoApplication.getApp;
|
||||
|
||||
public class TrafficModelData {
|
||||
|
||||
private static final String TAG = "TrafficModelData";
|
||||
private TrafficApiService mTrafficApiService;
|
||||
|
||||
public TrafficModelData() {
|
||||
IMogoNetwork network = (IMogoNetwork) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICES_NETWORK).navigation(getApp().getApplicationContext());
|
||||
mTrafficApiService = network.create(TrafficApiService.class, HttpConstant.getTMCHost());
|
||||
}
|
||||
|
||||
/**
|
||||
* 拥堵信息上报
|
||||
*
|
||||
* @param uploadTrafficEntity 高的返回的拥堵信息对象
|
||||
* @param
|
||||
*/
|
||||
public void uploadTrafficInfo(UploadTrafficEntity uploadTrafficEntity) {
|
||||
|
||||
final ParamsProvider.Builder builder = new ParamsProvider.Builder( getApp().getApplicationContext());
|
||||
Map<String, Object> parameters = builder.build();
|
||||
parameters.put("sn", Utils.getSn());
|
||||
parameters.put("data",GsonUtil.jsonFromObject(uploadTrafficEntity));
|
||||
mTrafficApiService.UploadCongestionInfo(parameters)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create( getApp().getApplicationContext())) {
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
Logger.d(TAG, "拥堵上报失败" + e.toString());
|
||||
// callback.UploadFail(e.getMessage(), -1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
super.onSuccess(o);
|
||||
Logger.d(TAG, "拥堵上报成功" + o.toString());
|
||||
// callback.UpLoadSuccess(o.msg.toString(), o.code);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
@@ -167,7 +167,7 @@ class BlockStrategy(private val context: Context, private val apis: IMogoService
|
||||
val params = ArrayMap<String, Any>()
|
||||
params["speed"] = average.toInt()
|
||||
val body = RequestBody.create(MediaType.parse("Content-type:application/json;charset=UTF-8"), GsonUtil.jsonFromObject(params))
|
||||
val disposable = apis.networkApi.create(ShareApiService::class.java, HttpConstant.getNetHost()).sendAverageSpeedForBlockStrategy(body, Utils.getSn()).subscribeOn(Schedulers.io()).subscribe(object : SubscribeImpl<AverateSpeedResponse>(RequestOptions.create(context)) {
|
||||
apis.networkApi.create(ShareApiService::class.java, HttpConstant.getNetHost()).sendAverageSpeedForBlockStrategy(body, Utils.getSn()).subscribeOn(Schedulers.io()).subscribe(object : SubscribeImpl<AverateSpeedResponse>(RequestOptions.create(context)) {
|
||||
override fun onSuccess(response: AverateSpeedResponse?) {
|
||||
super.onSuccess(response)
|
||||
response?.let {
|
||||
|
||||
@@ -30,6 +30,7 @@ import com.mogo.service.module.IMogoMarkerService;
|
||||
import com.mogo.service.module.IMogoRegisterCenter;
|
||||
import com.mogo.service.module.IMogoSearchManager;
|
||||
import com.mogo.service.share.IMogoShareManager;
|
||||
import com.mogo.service.share.IMogoTrafficUploadProvider;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.service.strategy.IMogoOnlineCarListPanelProvider;
|
||||
import com.mogo.service.strategy.IMogoRefreshStrategyController;
|
||||
@@ -72,6 +73,7 @@ public class V2XServiceManager {
|
||||
private static IMogoMarkerService mIMogoMarkerService;
|
||||
private static IMogoShareManager mIMogoShareManager;
|
||||
private static IMogoTanluProvider mIMogoTanluProvider;
|
||||
private static IMogoTrafficUploadProvider mIMogoTrafficUploadProvider;
|
||||
//事件面板
|
||||
private static IEventPanelProvider mIEventPanelProvider;
|
||||
|
||||
@@ -120,6 +122,7 @@ public class V2XServiceManager {
|
||||
mIMogoMarkerService = mMogoServiceApis.getMarkerService();
|
||||
mIMogoShareManager = mMogoServiceApis.getShareManager();
|
||||
mIMogoTanluProvider = mMogoServiceApis.getTanluApi();
|
||||
mIMogoTrafficUploadProvider = mMogoServiceApis.getTrafficUploadApi();
|
||||
mMogoOnlineCarListPanelProvider = mMogoServiceApis.getOnlineCarPanelApi();
|
||||
//事件面板
|
||||
mIEventPanelProvider = mMogoServiceApis.getEventPanelManager();
|
||||
@@ -274,6 +277,9 @@ public class V2XServiceManager {
|
||||
return mIMogoTanluProvider;
|
||||
}
|
||||
|
||||
public static IMogoTrafficUploadProvider getIMogoTrafficUploadProvider(){
|
||||
return mIMogoTrafficUploadProvider;
|
||||
}
|
||||
|
||||
public static IMogoOnlineCarListPanelProvider getMogoOnlineCarListPanelProvider() {
|
||||
return mMogoOnlineCarListPanelProvider;
|
||||
|
||||
@@ -71,7 +71,7 @@ class V2XEventPanelFragment : MvpFragment<V2XEventPanelFragment, EventPanelPrese
|
||||
}
|
||||
|
||||
// 打开出行动态TAB
|
||||
private val mCheckHistoryEventCb = V2XVoiceCallbackListener { command: String?, intent: Intent? ->
|
||||
private val mCheckHistoryEventCb = V2XVoiceCallbackListener { _: String?, _: Intent? ->
|
||||
try {
|
||||
mRbScenarioHistory?.isChecked = true
|
||||
} catch (e: java.lang.Exception) {
|
||||
@@ -80,7 +80,7 @@ class V2XEventPanelFragment : MvpFragment<V2XEventPanelFragment, EventPanelPrese
|
||||
}
|
||||
|
||||
// 打开周边事件TAB
|
||||
private val mCheckSurroundingCb = V2XVoiceCallbackListener { command: String?, intent: Intent? ->
|
||||
private val mCheckSurroundingCb = V2XVoiceCallbackListener { _: String?, _: Intent? ->
|
||||
try {
|
||||
mRbSurroundingEvent?.isChecked = true
|
||||
} catch (e: java.lang.Exception) {
|
||||
@@ -89,7 +89,7 @@ class V2XEventPanelFragment : MvpFragment<V2XEventPanelFragment, EventPanelPrese
|
||||
}
|
||||
|
||||
// 打开我的分享TAB
|
||||
private val mCheckShearEventCb = V2XVoiceCallbackListener { command: String?, intent: Intent? ->
|
||||
private val mCheckShearEventCb = V2XVoiceCallbackListener { _: String?, _: Intent? ->
|
||||
try {
|
||||
mRbShareEvents?.isChecked = true
|
||||
} catch (e: java.lang.Exception) {
|
||||
@@ -98,7 +98,7 @@ class V2XEventPanelFragment : MvpFragment<V2XEventPanelFragment, EventPanelPrese
|
||||
}
|
||||
|
||||
// 打关闭事件面板
|
||||
private val mCloeEventCb = V2XVoiceCallbackListener { command: String?, intent: Intent? ->
|
||||
private val mCloeEventCb = V2XVoiceCallbackListener { _: String?, _: Intent? ->
|
||||
try {
|
||||
TrackUtils.trackV2xHistoryEvent(5)
|
||||
hidePanel()
|
||||
@@ -132,7 +132,7 @@ class V2XEventPanelFragment : MvpFragment<V2XEventPanelFragment, EventPanelPrese
|
||||
mVpEventPanel?.adapter = V2XEventPagerAdapter(this, fragments!!)
|
||||
mVpEventPanel?.isUserInputEnabled = false; //true:滑动,false:禁止滑动
|
||||
|
||||
mRgTabSelect?.setOnCheckedChangeListener { group, checkedId ->
|
||||
mRgTabSelect?.setOnCheckedChangeListener { _, checkedId ->
|
||||
when (checkedId) {
|
||||
R.id.rbScenarioHistory -> {
|
||||
// 更改选中是否加粗
|
||||
|
||||
@@ -84,7 +84,7 @@ public class V2XRoadEventScenario extends AbsV2XScenario<V2XRoadEventEntity> imp
|
||||
|
||||
boolean onlyShow = getV2XMessageEntity().isOnlyShow();
|
||||
|
||||
if (onlyShow == false){
|
||||
if (onlyShow == false) {
|
||||
// 设置TTS
|
||||
getV2XMessageEntity().getContent().getTts(false);
|
||||
// 广播给ADASzzz
|
||||
@@ -198,7 +198,7 @@ public class V2XRoadEventScenario extends AbsV2XScenario<V2XRoadEventEntity> imp
|
||||
public void onViewAdded(View view) {
|
||||
Logger.d(MODULE_NAME, "展示 Window 动画结束");
|
||||
if (V2XServiceManager.getMoGoStatusManager().isMainPageLaunched()) {
|
||||
if (getV2XMessageEntity() != null && getV2XMessageEntity().isNeedAddLine() == true){
|
||||
if (getV2XMessageEntity() != null && getV2XMessageEntity().isNeedAddLine() == true) {
|
||||
drawPOI();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ import com.mogo.utils.logger.Logger;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.mogo.module.common.entity.MarkerPoiTypeEnum.FOURS_BLOCK_UP;
|
||||
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
|
||||
|
||||
/**
|
||||
@@ -168,12 +169,19 @@ public class V2XRoadEventWindow extends RelativeLayout
|
||||
if (v2XRoadEventEntity != null) {
|
||||
// 道路事件行驶到了50米附近,弹出事件纠错框给用户
|
||||
//Logger.d(MODULE_NAME, "V2X===道路事件:" + v2XRoadEventEntity);
|
||||
|
||||
//如果poiType是道路拥堵,则调用接口查询拥堵状态
|
||||
String poiType = v2XRoadEventEntity.getPoiType();
|
||||
if(poiType != null && poiType.equals(FOURS_BLOCK_UP)){
|
||||
V2XServiceManager.getIMogoTrafficUploadProvider().verifyCurrentTrafficStatus();
|
||||
}
|
||||
|
||||
// 进行类型分发
|
||||
switch (v2XRoadEventEntity.getPoiType()) {
|
||||
case V2XPoiTypeEnum.TRAFFIC_CHECK: // 交通检查
|
||||
case V2XPoiTypeEnum.ROAD_CLOSED://封路
|
||||
case V2XPoiTypeEnum.FOURS_ROAD_WORK://施工
|
||||
case V2XPoiTypeEnum.FOURS_BLOCK_UP://拥堵
|
||||
case FOURS_BLOCK_UP://拥堵
|
||||
case V2XPoiTypeEnum.FOURS_PONDING://积水
|
||||
case V2XPoiTypeEnum.FOURS_FOG://浓雾
|
||||
case V2XPoiTypeEnum.FOURS_ICE://结冰
|
||||
|
||||
@@ -54,6 +54,7 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
|
||||
private Button mBtnTriggerParkEvent;
|
||||
private Button mBtnTriggerCallUserInfo;
|
||||
private Button mBtnTriggerEventUgc;
|
||||
private Button mBtnTriggerTrafficSearch;
|
||||
|
||||
public static V2XTestConsoleWindow getInstance(Context context, int showType) {
|
||||
if (mV2XTestConsoleWindow == null) {
|
||||
@@ -101,6 +102,7 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
|
||||
mBtnTriggerParkEvent = findViewById(R.id.btnTriggerParkEvent);
|
||||
mBtnTriggerEventUgc = findViewById(R.id.btnTriggerEventUgc);
|
||||
mBtnTriggerCallUserInfo = findViewById(R.id.btnTriggerCallUserInfo);
|
||||
mBtnTriggerTrafficSearch = findViewById(R.id.btnTriggerTrafficSearch);
|
||||
|
||||
switch (showType) {
|
||||
case 0:
|
||||
@@ -214,6 +216,7 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
|
||||
LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent);
|
||||
});
|
||||
|
||||
mBtnTriggerTrafficSearch.setOnClickListener(v-> V2XServiceManager.getIMogoTrafficUploadProvider().verifyCurrentTrafficStatus());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -149,6 +149,7 @@ class SimpleCoverVideoPlayer : StandardGSYVideoPlayer {
|
||||
mFullPauseBitmap = null
|
||||
if (mAudioManager != null) {
|
||||
try {
|
||||
@Suppress("DEPRECATION")
|
||||
mAudioManager.abandonAudioFocus(onAudioFocusChangeListener)
|
||||
} catch (e: Exception) {
|
||||
Logger.e(TAG, e, "onDetachedFromWindow - abandonAudioFocus")
|
||||
|
||||
@@ -47,8 +47,9 @@
|
||||
android:id="@+id/ivIconP"
|
||||
android:layout_width="@dimen/module_v2x_history_event_icon_size"
|
||||
android:layout_height="@dimen/module_v2x_history_event_icon_size"
|
||||
android:layout_marginEnd="@dimen/dp_16"
|
||||
android:layout_marginEnd="@dimen/dp_26"
|
||||
android:src="@drawable/icon_illegal_parking"
|
||||
app:layout_constraintRight_toLeftOf="@+id/tvAddress"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/tagEventType"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tagEventType"
|
||||
app:layout_constraintTop_toTopOf="@+id/tvAddress" />
|
||||
@@ -57,7 +58,6 @@
|
||||
android:id="@+id/tvAddress"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_12"
|
||||
android:layout_marginTop="@dimen/dp_24"
|
||||
android:layout_marginRight="@dimen/dp_30"
|
||||
android:ellipsize="end"
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
android:id="@+id/tagEventType"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/module_v2x_surrounding_item_bottom_image_height"
|
||||
android:layout_marginStart="@dimen/dp_36"
|
||||
android:layout_marginTop="@dimen/dp_24"
|
||||
android:background="@drawable/bg_v2x_event_type_orange"
|
||||
android:gravity="center"
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
android:layout_height="@dimen/dp_88"
|
||||
android:layout_marginEnd="@dimen/dp_28"
|
||||
android:layout_marginBottom="@dimen/dp_40"
|
||||
android:background="@drawable/icon_window_close2"
|
||||
android:background="@drawable/v2x_panel_close"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent" />
|
||||
|
||||
|
||||
@@ -165,6 +165,20 @@
|
||||
android:textSize="@dimen/dp_22"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnTriggerTrafficSearch"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_10"
|
||||
android:layout_marginBottom="@dimen/dp_10"
|
||||
android:background="#3196E2"
|
||||
android:padding="@dimen/dp_10"
|
||||
android:text="交通状况查询"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="@dimen/dp_22"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
</com.google.android.flexbox.FlexboxLayout>
|
||||
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ import com.mogo.service.network.IMogoNetwork;
|
||||
import com.mogo.service.obu.IMogoObuManager;
|
||||
import com.mogo.service.passport.IMogoPassportManager;
|
||||
import com.mogo.service.share.IMogoShareManager;
|
||||
import com.mogo.service.share.IMogoTrafficUploadProvider;
|
||||
import com.mogo.service.statusmanager.IMogoMsgCenter;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.service.strategy.IMogoOnlineCarListPanelProvider;
|
||||
@@ -278,4 +279,10 @@ public interface IMogoServiceApis extends IProvider {
|
||||
* @return
|
||||
*/
|
||||
IMogoOnlineCarListPanelProvider getOnlineCarPanelApi();
|
||||
|
||||
/**
|
||||
* 获取交通状况服务
|
||||
* @return
|
||||
*/
|
||||
IMogoTrafficUploadProvider getTrafficUploadApi();
|
||||
}
|
||||
|
||||
@@ -245,6 +245,18 @@ public class MogoServicePaths {
|
||||
@Deprecated
|
||||
public static final String PATH_STRATEGY_SHARE = "/share/strategy";
|
||||
|
||||
/**
|
||||
* 分享模块中,交通状况服务上报
|
||||
*/
|
||||
@Deprecated
|
||||
public static final String PATH_TRAFFIC_UPLOAD = "/share/traffic";
|
||||
|
||||
/**
|
||||
* 高德地图巡航上报
|
||||
*/
|
||||
@Deprecated
|
||||
public static final String PATH_GAODE_AIMLESS_SHARE = "/share/gaodeAimless";
|
||||
|
||||
/**
|
||||
* 探路ui
|
||||
*/
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.mogo.map.IMogoMapViewInstanceHandler;
|
||||
import com.mogo.map.listener.IMogoHosListenerRegister;
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.map.marker.IMogoMarkerManager;
|
||||
import com.mogo.map.navi.IMogoAimless;
|
||||
import com.mogo.map.navi.IMogoNavi;
|
||||
import com.mogo.map.overlay.IMogoOverlayManager;
|
||||
import com.mogo.map.search.drive.IMogoRoadSearch;
|
||||
@@ -15,6 +16,7 @@ import com.mogo.map.search.inputtips.IMogoInputtipsSearch;
|
||||
import com.mogo.map.search.inputtips.query.MogoInputtipsQuery;
|
||||
import com.mogo.map.search.poisearch.IMogoPoiSearch;
|
||||
import com.mogo.map.search.poisearch.query.MogoPoiSearchQuery;
|
||||
import com.mogo.map.search.traffic.IMogoTrafficSearch;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
|
||||
/**
|
||||
@@ -77,6 +79,14 @@ public interface IMogoMapService extends IProvider {
|
||||
*/
|
||||
IMogoNavi getNavi( Context context );
|
||||
|
||||
/**
|
||||
* 获取巡航操作实例
|
||||
*
|
||||
* @param context
|
||||
* @return
|
||||
*/
|
||||
IMogoAimless getAimless(Context context);
|
||||
|
||||
/**
|
||||
* marker 操作
|
||||
*
|
||||
@@ -119,4 +129,11 @@ public interface IMogoMapService extends IProvider {
|
||||
* @return
|
||||
*/
|
||||
IMogoMapViewInstanceHandler getMapViewInstanceHandler();
|
||||
|
||||
/**
|
||||
* 交通态势查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
IMogoTrafficSearch getTrafficSearchApi();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.mogo.service.share;
|
||||
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
|
||||
public interface IMogoTrafficUploadProvider extends IProvider {
|
||||
|
||||
/**
|
||||
* 验证当前交通状况并上报
|
||||
*/
|
||||
void verifyCurrentTrafficStatus();
|
||||
}
|
||||
@@ -36,6 +36,7 @@ import com.mogo.service.network.IMogoNetwork;
|
||||
import com.mogo.service.obu.IMogoObuManager;
|
||||
import com.mogo.service.passport.IMogoPassportManager;
|
||||
import com.mogo.service.share.IMogoShareManager;
|
||||
import com.mogo.service.share.IMogoTrafficUploadProvider;
|
||||
import com.mogo.service.statusmanager.IMogoMsgCenter;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.service.strategy.IMogoOnlineCarListPanelProvider;
|
||||
@@ -238,6 +239,11 @@ public class MogoServiceApis implements IMogoServiceApis {
|
||||
return getApiInstance( IMogoOnlineCarListPanelProvider.class, MogoServicePaths.PATH_ONLINE_CAR_PANEL);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoTrafficUploadProvider getTrafficUploadApi() {
|
||||
return getApiInstance(IMogoTrafficUploadProvider.class, MogoServicePaths.PATH_TRAFFIC_UPLOAD);
|
||||
}
|
||||
|
||||
private static < T extends IProvider > T getApiInstance( Class< T > clazz, String path ) {
|
||||
T inst = SingletonsHolder.get( clazz );
|
||||
if ( inst == null ) {
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.map.IMogoMapViewInstanceHandler;
|
||||
import com.mogo.map.MogoAimless;
|
||||
import com.mogo.map.MogoGeoSearch;
|
||||
import com.mogo.map.MogoInputtipsSearch;
|
||||
import com.mogo.map.MogoLocationClient;
|
||||
@@ -14,10 +15,12 @@ import com.mogo.map.MogoNavi;
|
||||
import com.mogo.map.MogoOverlayManager;
|
||||
import com.mogo.map.MogoPoiSearch;
|
||||
import com.mogo.map.MogoRoadSearch;
|
||||
import com.mogo.map.MogoTrafficSearch;
|
||||
import com.mogo.map.listener.IMogoHosListenerRegister;
|
||||
import com.mogo.map.listener.MogoHosListenerRegister;
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.map.marker.IMogoMarkerManager;
|
||||
import com.mogo.map.navi.IMogoAimless;
|
||||
import com.mogo.map.navi.IMogoNavi;
|
||||
import com.mogo.map.overlay.IMogoOverlayManager;
|
||||
import com.mogo.map.search.drive.IMogoRoadSearch;
|
||||
@@ -26,6 +29,7 @@ import com.mogo.map.search.inputtips.IMogoInputtipsSearch;
|
||||
import com.mogo.map.search.inputtips.query.MogoInputtipsQuery;
|
||||
import com.mogo.map.search.poisearch.IMogoPoiSearch;
|
||||
import com.mogo.map.search.poisearch.query.MogoPoiSearchQuery;
|
||||
import com.mogo.map.search.traffic.IMogoTrafficSearch;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.map.IMogoMapService;
|
||||
@@ -69,6 +73,11 @@ public class MogoMapService implements IMogoMapService {
|
||||
return MogoNavi.getInstance( context );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoAimless getAimless(Context context) {
|
||||
return MogoAimless.getInstance( context );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoMarkerManager getMarkerManager( Context context ) {
|
||||
return MogoMarkerManager.getInstance( context );
|
||||
@@ -99,6 +108,11 @@ public class MogoMapService implements IMogoMapService {
|
||||
return MogoMapViewInstanceHandler.getInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoTrafficSearch getTrafficSearchApi() {
|
||||
return new MogoTrafficSearch();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user