delete tanlu module
@@ -341,9 +341,7 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.modulesplash
|
||||
implementation rootProject.ext.dependencies.moduleV2x
|
||||
implementation rootProject.ext.dependencies.moduleshare
|
||||
// implementation rootProject.ext.dependencies.moduletanlu, {
|
||||
// exclude group: 'com.mogo.module', module: 'module-share'
|
||||
// }
|
||||
|
||||
implementation rootProject.ext.dependencies.tanluupload
|
||||
implementation rootProject.ext.dependencies.mogomonitor
|
||||
implementation rootProject.ext.dependencies.mogomoduleback
|
||||
@@ -358,9 +356,7 @@ dependencies {
|
||||
implementation project(':modules:mogo-module-splash')
|
||||
implementation project(':modules:mogo-module-v2x')
|
||||
implementation project(':modules:mogo-module-share')
|
||||
// implementation project(':modules:mogo-module-tanlu'), {
|
||||
// exclude group: 'com.mogo.module', module: 'module-share'
|
||||
// }
|
||||
|
||||
implementation project(':libraries:tanlulib')
|
||||
implementation project(':modules:mogo-module-monitor')
|
||||
implementation project(':modules:mogo-module-back')
|
||||
|
||||
1
modules/mogo-module-tanlu/.gitignore
vendored
@@ -1 +0,0 @@
|
||||
/build
|
||||
@@ -1,85 +0,0 @@
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply plugin: 'kotlin-android-extensions'
|
||||
apply plugin: 'com.alibaba.arouter'
|
||||
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.android.compileSdkVersion
|
||||
// buildToolsVersion rootProject.ext.android.buildToolsVersion
|
||||
defaultConfig {
|
||||
minSdkVersion rootProject.ext.android.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.android.targetSdkVersion
|
||||
versionCode Integer.valueOf(VERSION_CODE)
|
||||
versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION")
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles 'consumer-rules.pro'
|
||||
|
||||
javaCompileOptions {
|
||||
annotationProcessorOptions {
|
||||
arguments = [AROUTER_MODULE_NAME: project.getName()]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
zipAlignEnabled true
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
abortOnError false
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
implementation rootProject.ext.dependencies.androidxccorektx
|
||||
implementation rootProject.ext.dependencies.kotlinstdlibjdk7
|
||||
implementation rootProject.ext.dependencies.androidxrecyclerview
|
||||
implementation rootProject.ext.dependencies.androidxappcompat
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
annotationProcessor rootProject.ext.dependencies.aroutercompiler
|
||||
implementation rootProject.ext.dependencies.androidxconstraintlayout
|
||||
implementation rootProject.ext.dependencies.rxjava
|
||||
implementation rootProject.ext.dependencies.rxandroid
|
||||
implementation rootProject.ext.dependencies.localbroadcastmanager
|
||||
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
compileOnly rootProject.ext.dependencies.mogomap
|
||||
compileOnly rootProject.ext.dependencies.mogoutils
|
||||
compileOnly rootProject.ext.dependencies.mogocommons
|
||||
compileOnly rootProject.ext.dependencies.mogoserviceapi
|
||||
compileOnly rootProject.ext.dependencies.modulecommon
|
||||
compileOnly rootProject.ext.dependencies.moduleshare
|
||||
}else{
|
||||
compileOnly project(":libraries:mogo-map")
|
||||
compileOnly project(":foudations:mogo-utils")
|
||||
compileOnly project(":foudations:mogo-commons")
|
||||
compileOnly project(":services:mogo-service-api")
|
||||
compileOnly project(":modules:mogo-module-common")
|
||||
compileOnly project(":modules:mogo-module-share")
|
||||
}
|
||||
compileOnly rootProject.ext.dependencies.carcallprovider
|
||||
|
||||
implementation rootProject.ext.dependencies.eventbus
|
||||
|
||||
|
||||
// if( Boolean.valueOf(RELEASE)){
|
||||
// implementation rootProject.ext.dependencies.moduletanlulib
|
||||
// } else {
|
||||
// implementation project(":tanlulib")
|
||||
// }
|
||||
}
|
||||
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
-keep class com.mogo.module.tanlu.model.**{*;}
|
||||
-keep class com.mogo.module.tanlu.fragment.*{*;}
|
||||
-keep class com.mogo.module.tanlu.receiver.*{*;}
|
||||
-keep class com.mogo.module.tanlu.video.*{*;}
|
||||
-keep interface * implements com.mogo.module.tanlu.net.TanluApiService
|
||||
-keep interface * implements com.mogo.module.tanlu.callback.AlongTheWayCallback
|
||||
-keep interface * implements com.mogo.module.tanlu.callback.IThumbsUpCallback
|
||||
-keep interface * implements com.mogo.module.tanlu.callback.NaviCallback
|
||||
-keep interface * implements com.mogo.module.tanlu.callback.RoadInfoCallback
|
||||
-keep interface * implements com.mogo.module.tanlu.callback.RoadLineCallback
|
||||
-keep interface * implements com.mogo.module.tanlu.callback.UploadShareCallback
|
||||
-keep interface * implements com.mogo.module.tanlu.callback.VoiceSearchCallback
|
||||
-keep class com.mogo.module.tanlu.util.*{*;}
|
||||
@@ -1,3 +0,0 @@
|
||||
GROUP=com.mogo.module
|
||||
POM_ARTIFACT_ID=module-tanlu
|
||||
VERSION_CODE=1
|
||||
40
modules/mogo-module-tanlu/proguard-rules.pro
vendored
@@ -1,40 +0,0 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
-keep class com.mogo.module.tanlu.model.**{*;}
|
||||
-keep class com.mogo.module.tanlu.fragment.*{*;}
|
||||
-keep class com.mogo.module.tanlu.receiver.*{*;}
|
||||
-keep class com.mogo.module.tanlu.video.*{*;}
|
||||
-keep interface * implements com.mogo.module.tanlu.net.TanluApiService
|
||||
-keep interface * implements com.mogo.module.tanlu.callback.AlongTheWayCallback
|
||||
-keep interface * implements com.mogo.module.tanlu.callback.IThumbsUpCallback
|
||||
-keep interface * implements com.mogo.module.tanlu.callback.NaviCallback
|
||||
-keep interface * implements com.mogo.module.tanlu.callback.RoadInfoCallback
|
||||
-keep interface * implements com.mogo.module.tanlu.callback.RoadLineCallback
|
||||
-keep interface * implements com.mogo.module.tanlu.callback.UploadShareCallback
|
||||
-keep interface * implements com.mogo.module.tanlu.callback.VoiceSearchCallback
|
||||
-keep class com.mogo.module.tanlu.util.*{*;}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mogo.module.tanlu">
|
||||
|
||||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
|
||||
<application>
|
||||
<activity
|
||||
android:name=".video.FullMediaActivity"
|
||||
android:hardwareAccelerated="true">
|
||||
</activity>
|
||||
|
||||
<receiver android:name=".receiver.MarkerInfoReceiver">
|
||||
<intent-filter>
|
||||
<action android:name="com.zhidao.roadcondition.marker.info" />
|
||||
<category android:name="android.intent.category.HOME" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<receiver android:name=".receiver.GetInfoFailedReceiver">
|
||||
<intent-filter>
|
||||
<action android:name="com.zhidao.roadcondition.getinfo.failed" />
|
||||
<category android:name="android.intent.category.HOME" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<receiver android:name=".receiver.PushReceiver">
|
||||
<intent-filter>
|
||||
<action android:name="com.zhidao.roadcondition.split" />
|
||||
<category android:name="android.intent.category.HOME" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<receiver android:name=".receiver.ShareDialogReceiver">
|
||||
<intent-filter>
|
||||
<action android:name="com.zhidao.sharedialog" />
|
||||
<category android:name="android.intent.category.HOME" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<receiver android:name=".receiver.DataErrorReceiver">
|
||||
<intent-filter>
|
||||
<action android:name="com.zhidao.tanlu.dataerror" />
|
||||
<category android:name="android.intent.category.HOME" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -1,13 +0,0 @@
|
||||
package com.mogo.module.tanlu.callback;
|
||||
|
||||
import com.mogo.module.tanlu.model.InformationAndLiveCarResult;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description 导航沿途搜索
|
||||
* @since 2020-01-09
|
||||
*/
|
||||
public interface AlongTheWayCallback {
|
||||
void onSuccess(InformationAndLiveCarResult data);
|
||||
void onFail(String message, int code);
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
package com.mogo.module.tanlu.callback;
|
||||
|
||||
import com.mogo.service.datamanager.IMogoDataChangedListener;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-02-12
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class DataSetChangedAdapter implements IMogoDataChangedListener {
|
||||
|
||||
private Object mData;
|
||||
|
||||
private DataSetChangedAdapter(){
|
||||
// private constructor
|
||||
}
|
||||
|
||||
private static final class InstanceHolder{
|
||||
private static final DataSetChangedAdapter INSTANCE = new DataSetChangedAdapter();
|
||||
}
|
||||
|
||||
private IMogoDataChangedListener mDelegate;
|
||||
|
||||
public void setDelegate( IMogoDataChangedListener delegate ) {
|
||||
this.mDelegate = delegate;
|
||||
}
|
||||
|
||||
public static DataSetChangedAdapter getInstance(){
|
||||
return InstanceHolder.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataSetChanged( Object data ) {
|
||||
mData = data;
|
||||
if ( mDelegate != null ) {
|
||||
mDelegate.onDataSetChanged( data );
|
||||
}
|
||||
}
|
||||
|
||||
public Object getData() {
|
||||
return mData;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
package com.mogo.module.tanlu.callback
|
||||
|
||||
interface IThumbsUpCallback {
|
||||
fun onThumbsUpSuccess()
|
||||
fun onThumbsUpFail()
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package com.mogo.module.tanlu.callback;
|
||||
|
||||
import com.mogo.module.tanlu.model.NaviResult;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description 导航沿途数据
|
||||
* @since 2020-01-09
|
||||
*/
|
||||
public interface NaviCallback {
|
||||
void onSuccess(NaviResult data);
|
||||
void onFail(String message, int code);
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package com.mogo.module.tanlu.callback
|
||||
|
||||
import com.mogo.module.common.entity.MarkerExploreWay
|
||||
import com.mogo.module.tanlu.model.RoadInfos
|
||||
|
||||
interface RoadInfoCallback {
|
||||
fun onLocatSuccess(lat: Double, lon: Double)
|
||||
fun onQueryRoadInfoSuccess(roadInfoList:List<MarkerExploreWay>)
|
||||
fun onQueryRoadInfoFail(msg: String, code: Int)
|
||||
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package com.mogo.module.tanlu.callback;
|
||||
|
||||
import com.mogo.module.tanlu.model.PathLineResult;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description 通勤族回调
|
||||
* @since 2020-01-09
|
||||
*/
|
||||
public interface RoadLineCallback {
|
||||
void onSuccess(PathLineResult data);
|
||||
void onFail(String message, int code);
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package com.mogo.module.tanlu.callback;
|
||||
|
||||
import com.mogo.commons.data.BaseData;
|
||||
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description 上报分享 废弃
|
||||
* @since 2020-01-09
|
||||
*/
|
||||
public interface UploadShareCallback {
|
||||
void onSuccess(BaseData data);
|
||||
void onFail(String message, int code);
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package com.mogo.module.tanlu.callback;
|
||||
|
||||
import com.mogo.module.tanlu.model.VoiceSearchResult;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description 声音控制搜索回调
|
||||
* @since 2020-01-09
|
||||
*/
|
||||
public interface VoiceSearchCallback {
|
||||
void onSuccess(VoiceSearchResult data);
|
||||
void onFail(String message, int code);
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
package com.mogo.module.tanlu.constant
|
||||
|
||||
const val REQUESTCODE_MAINACTIVITY = 0
|
||||
const val REQUESTCODE_MEDIAACTIVITY = 1
|
||||
|
||||
//EXTRA_STATE
|
||||
const val AUTO_NAVI_START = 8 //开始导航
|
||||
const val AUTO_NAVI_END = 9 //结束导航
|
||||
|
||||
// 道路事件名称,用于语音识别区分道路事件
|
||||
const val TYPE_NAME_BLOCK = "拥堵"
|
||||
const val TYPE_NAME_TRAFFIC_CHECK = "交通检查"
|
||||
const val TYPE_NAME_CLOSURE = "封路"
|
||||
const val TYPE_NAME_ACCIDENT = "交通事故"
|
||||
const val TYPE_NAME_REAL_TIME_TRAFFIC = "实时路况"
|
||||
const val TYPE_NAME_STAGNANT_WATER = "积水"
|
||||
const val TYPE_NAME_ROAD_ICY = "积冰"
|
||||
const val TYPE_NAME_DENSE_FOG = "雾"
|
||||
const val TYPE_NAME_ROAD_CONSTRUCTION = "施工"
|
||||
|
||||
/**
|
||||
* 搜索交通检查
|
||||
*/
|
||||
const val VOICE_COMMAND_QUERY_TRAFFIC_CHECK = "com.zhidao.share.traffic.police"
|
||||
|
||||
/**
|
||||
* 搜索封路信息
|
||||
*/
|
||||
const val VOICE_COMMAND_QUERY_ROAD_CLOSED = "com.zhidao.share.road.closure.query"
|
||||
|
||||
/**
|
||||
* 其他道路事件,包括事故,实时路况,道路积水,道路积冰,浓雾
|
||||
*/
|
||||
const val VOICE_COMMAND_NOVELTY_QUERY = "com.zhidao.novelty.query"
|
||||
@@ -1,13 +0,0 @@
|
||||
package com.mogo.module.tanlu.constant;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description
|
||||
* @since 2020-01-09
|
||||
*/
|
||||
public class HttpConst {
|
||||
public static final String HOST_DEV = "http://dzt-test.zhidaohulian.com";
|
||||
public static final String HOST_SHOW = "http://dzt-show.zhidaohulian.com";
|
||||
public static final String HOST_TEST = "http://dzt-test.zhidaohulian.com";
|
||||
public static final String HOST_PRODUCT = "https://dzt.zhidaohulian.com";
|
||||
}
|
||||
@@ -1,112 +0,0 @@
|
||||
package com.mogo.module.tanlu.constant;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-24
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class TanluConstants {
|
||||
|
||||
/**
|
||||
* 加油 10001
|
||||
* 交通检查 10002
|
||||
* 封路 10003
|
||||
* 商场打折 10004
|
||||
* 4S店 10005
|
||||
* 施工 10006
|
||||
* 拥堵 10007
|
||||
* 积水 10008
|
||||
* 超市折扣 10009
|
||||
* 浓雾 10010
|
||||
* 结冰 10011
|
||||
* 停车场 10012
|
||||
* 交通事故 10013
|
||||
* 社保 10014
|
||||
* 实时路况 10015
|
||||
*/
|
||||
public static final String TANLU_ROAD_PONDING = "10008"; //积水
|
||||
public static final String TANLU_ROAD_ICING = "10011"; //积冰
|
||||
public static final String TANLU_ROAD_HEAVY_FOG = "10010"; //大雾
|
||||
public static final String TANLU_ROAD_ACCIDENT = "10013"; //事故
|
||||
public static final String TANLU_ROAD_CONSTRUCTION = "10006"; //道路施工
|
||||
public static final String TANLU_ROAD_CONGESTION_COMPAT = "10007"; //拥堵,适配语音不做数值转换
|
||||
public static final String TANLU_TRAFFIC_CHECK_COMPAT = "10002"; //交通检查,适配语音不做数值转换
|
||||
public static final String TANLU_ROAD_CLOSURE_COMPAT = "10003"; //封路,适配语音不做数值转换
|
||||
public static final String TANLU_ROAD_CURRENT = "10015"; //实时路况
|
||||
|
||||
|
||||
public static final String TAG = "/tanlu/ui";
|
||||
public static final String NAVI_INFO = "navi_info";
|
||||
public static final String MODEL_NAME = "CARD_TYPE_ROAD_CONDITION";
|
||||
|
||||
public static final String[] CMD_PLAY_ROAD_CONDITION = {"播放路况"};
|
||||
public static final String[] CMD_THE_PREVIOUS = {"上一条"};
|
||||
public static final String[] CMD_THE_NEXT = {"下一条"};
|
||||
public static final String[] CMD_UPLOAD_BLOCK = {"上报拥堵"};
|
||||
public static final String[] CMD_TRAFFIC_CHECK = {"上报交通检查"};
|
||||
public static final String[] CMD_ROAD_CLOSURE = {"上报封路"};
|
||||
|
||||
//上报拥堵
|
||||
public static final String UPLOAD_ROAD_BLOCK = "command_upload_block";
|
||||
//上报交通检查
|
||||
public static final String UPLOAD_TRAFFIC_CHECK = "command_upload_traffic_check";
|
||||
//上报封路
|
||||
public static final String UPLOAD_ROAD_CLOSURE = "command_upload_road_closure";
|
||||
|
||||
//上报路况
|
||||
public static final String UPLOAD_ROAD_CONDITION = "command_upload_roadcondition";
|
||||
//打开探路 免唤醒
|
||||
public static final String OPEN_ROADCONDITION = "command_open_roadcondition";
|
||||
//打开探路 唤醒
|
||||
public static final String OPEN_ROADCONDITION_AWAKE = "com.zhidao.desk.switchCard";
|
||||
//打开探路 唤醒
|
||||
public static final String OPEN_ROADCONDITION_AWAKE_COMMAND = "system.application.operation";
|
||||
|
||||
// 同行者 xx堵不堵 唤醒
|
||||
public static final String TXZ_SPECIFIEDROAD_SEARCH = "com.zhidao.roadcondition.roadinfo";
|
||||
|
||||
//思必驰 xx堵不堵 唤醒
|
||||
public static final String SPECIFIEDROAD_SEARCH = "com.zhidao.pathfinder.specifiedroad.search";
|
||||
//播放 免唤醒
|
||||
public static final String PLAY_VIDEO = "com.zhidao.tanlu.play";
|
||||
//播放 唤醒
|
||||
public static final String PLAY_VIDEO_AWAKEN = "com.zhidao.pathfinder.play.roadCondition";
|
||||
//分享路况/上报路况/上报拥堵/上报交通检查/上报封路 唤醒
|
||||
public static final String UPLOAD_ROAD_CONDITION_AWAKEN = "com.zhidao.pathfinder.report.roadCondition";
|
||||
//关闭分享框 唤醒
|
||||
public static final String SHARE_DIALOG_CLOSE = "com.zhidao.share.close";
|
||||
|
||||
public static final String AWAKE_NOTIFY = "com.zhidao.speech.awake.notify";
|
||||
|
||||
|
||||
//上一条
|
||||
// public static final String THE_PREVIOUS = "com.zhidao.tanlu.previous";
|
||||
//下一条
|
||||
// public static final String THE_NEXT = "com.zhidao.tanlu.next";
|
||||
|
||||
//分享封路
|
||||
public static final String SHARE_ROAD_CLOSURE = "com.zhidao.share.road.closure";
|
||||
//分享交通检查
|
||||
public static final String SHARE_TRAFFIC_CHECK = "com.zhidao.share.traffic.check";
|
||||
//我要分享
|
||||
public static final String GO_TO_SHARE = "com.zhidao.share";
|
||||
|
||||
//埋点数据
|
||||
//marker点击
|
||||
public static final String LAUNCHER_ICON_CLICK = "Launcher_Icon_Click";
|
||||
//分享分类 1:路况,2:油价,3:交通检查,4:封路
|
||||
public static final String LAUNCHER_SHARE_TYPE = "Launcher_Share_type";
|
||||
//分享/上报按钮点击 from=1 手动点击 from=2 语音打开
|
||||
public static final String LAUNCHER_SHARE_CLICK = "Launcher_Share_Click";
|
||||
public static final String CARNET_USER_UPLOAD = "CarNet_user_upload";
|
||||
|
||||
public static final String CARNET_ROAD_ENVENT = "v2x_road_event";
|
||||
|
||||
//语音搜索
|
||||
public static final String CARNET_VOICE_SEARCH = "CarNet_Voice_Search";
|
||||
|
||||
//视频播放
|
||||
public static final String CARNET_USER_VIDEO_PLAY = "CarNet_user_video_play";
|
||||
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
package com.mogo.module.tanlu.fragment;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.module.tanlu.callback.DataSetChangedAdapter;
|
||||
import com.mogo.module.tanlu.model.event.MarkerInfo;
|
||||
import com.mogo.module.tanlu.constant.TanluConstants;
|
||||
import com.mogo.service.share.IMogoTanluUiProvider;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import io.reactivex.Single;
|
||||
import io.reactivex.SingleOnSubscribe;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-24
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
@Route( path = TanluConstants.TAG )
|
||||
public class TanluCardViewProvider implements IMogoTanluUiProvider {
|
||||
|
||||
private static final String TAG = "TanluCardViewProvider";
|
||||
|
||||
private TanluListWindow tanluListWindow;
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
Logger.d(TAG, "init --------------> 1");
|
||||
// TanluServiceManager.init( context );
|
||||
// TanluServiceManager.getDataManager().registerDataListener( TanluConstants.MODEL_NAME, DataSetChangedAdapter.getInstance() );
|
||||
//
|
||||
// tanluListWindow = new TanluListWindow(context);
|
||||
// tanluListWindow.initWindow();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void searchRoadCondition(String intentStr, String data, String city, String keywords) {
|
||||
Disposable disposable = Single.create((SingleOnSubscribe<Intent>) emitter -> {
|
||||
Logger.d(TAG, "searchRoadCondition---> intentStr: " + intentStr + " data: " + data + " " +
|
||||
"city: " + city + " keywords: " + keywords);
|
||||
Intent intent = new Intent(intentStr);
|
||||
intent.putExtra("data", data);
|
||||
intent.putExtra("city", city);
|
||||
intent.putExtra("keywords", keywords);
|
||||
Thread.sleep(3000);
|
||||
emitter.onSuccess(intent);
|
||||
}).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(intent -> {
|
||||
Logger.d(TAG, "searchRoadCondition---go real share");
|
||||
tanluListWindow.realShare(intentStr, intent);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shareSuccess(String poiType, MogoLatLng location) {
|
||||
MarkerInfo markerInfo = new MarkerInfo(poiType, "", location.lon, location.lat, true, "1");
|
||||
EventBus.getDefault().post(markerInfo);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,99 +0,0 @@
|
||||
package com.mogo.module.tanlu.fragment;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.map.search.poisearch.IMogoPoiSearch;
|
||||
import com.mogo.map.search.poisearch.query.MogoPoiSearchQuery;
|
||||
import com.mogo.module.carchattingprovider.ICarsChattingProvider;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.analytics.IMogoAnalytics;
|
||||
import com.mogo.service.datamanager.IMogoDataManager;
|
||||
import com.mogo.service.intent.IMogoIntentManager;
|
||||
import com.mogo.service.map.IMogoMapService;
|
||||
import com.mogo.service.module.IMogoRegisterCenter;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.service.windowview.IMogoTopViewManager;
|
||||
import com.zhidao.carchattingprovider.CallChattingProviderConstant;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @since 2020-5-19
|
||||
* <p>
|
||||
* 持有服务接口实例
|
||||
*/
|
||||
public class TanluServiceManager {
|
||||
private static IMogoMapService mMapService;
|
||||
private static IMogoPoiSearch mPoiSearch;
|
||||
private static IMogoLocationClient mLocationClient;
|
||||
private static IMogoDataManager mDataManager;
|
||||
private static IMogoServiceApis mServiceApis;
|
||||
private static IMogoStatusManager mIMogoStatusManager;
|
||||
private static IMogoAnalytics mAnalytics;
|
||||
private static IMogoIntentManager mogoIntentManager;
|
||||
private static IMogoRegisterCenter mogoRegisterCenter;
|
||||
private static ICarsChattingProvider mCarsChattingProvider;
|
||||
private static IMogoTopViewManager mIMogoTopViewManager;
|
||||
|
||||
public static void init(Context context) {
|
||||
mServiceApis = (IMogoServiceApis) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(context);
|
||||
mMapService = mServiceApis.getMapServiceApi();
|
||||
mDataManager = mServiceApis.getDataManagerApi();
|
||||
mIMogoStatusManager = mServiceApis.getStatusManagerApi();
|
||||
mAnalytics = mServiceApis.getAnalyticsApi();
|
||||
mogoIntentManager = mServiceApis.getIntentManagerApi();
|
||||
mogoRegisterCenter = mServiceApis.getRegisterCenterApi();
|
||||
|
||||
mCarsChattingProvider = (ICarsChattingProvider) ARouter.getInstance().build(CallChattingProviderConstant.CAR_CALL_PROVIDER).navigation();
|
||||
mIMogoTopViewManager = mServiceApis.getTopViewManager();
|
||||
mPoiSearch = mMapService.getPoiSearch(context, new MogoPoiSearchQuery());
|
||||
mLocationClient = mMapService.getSingletonLocationClient(context);
|
||||
}
|
||||
|
||||
public static IMogoTopViewManager getIMogoTopViewManager() {
|
||||
return mIMogoTopViewManager;
|
||||
}
|
||||
|
||||
public static IMogoRegisterCenter getIMogoRegisterCenter() {
|
||||
return mogoRegisterCenter;
|
||||
}
|
||||
|
||||
public static IMogoMapService getMapService() {
|
||||
return mMapService;
|
||||
}
|
||||
|
||||
public static IMogoPoiSearch getPoiSearch() {
|
||||
return mPoiSearch;
|
||||
}
|
||||
|
||||
public static IMogoLocationClient getLocationClient() {
|
||||
return mLocationClient;
|
||||
}
|
||||
|
||||
public static IMogoAnalytics getAnalytics() {
|
||||
return mAnalytics;
|
||||
}
|
||||
|
||||
public static IMogoIntentManager getMogoIntentManager() {
|
||||
return mogoIntentManager;
|
||||
}
|
||||
|
||||
public static IMogoStatusManager getMogoStatusManager() {
|
||||
return mIMogoStatusManager;
|
||||
}
|
||||
|
||||
public static IMogoDataManager getDataManager() {
|
||||
return mDataManager;
|
||||
}
|
||||
|
||||
public static IMogoServiceApis getServiceApis() {
|
||||
return mServiceApis;
|
||||
}
|
||||
|
||||
public static ICarsChattingProvider getCarsChattingProvider() {
|
||||
return mCarsChattingProvider;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,561 +0,0 @@
|
||||
package com.mogo.module.tanlu.fragment.recycler;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorInflater;
|
||||
import android.animation.AnimatorSet;
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.module.carchattingprovider.ICarsChattingProvider;
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
import com.mogo.module.common.glide.SkinAbleBitmapTarget;
|
||||
import com.mogo.module.tanlu.R;
|
||||
import com.mogo.module.tanlu.callback.IThumbsUpCallback;
|
||||
import com.mogo.module.tanlu.constant.TanluConstants;
|
||||
import com.mogo.module.tanlu.model.TanluModelData;
|
||||
import com.mogo.module.tanlu.model.event.CloseWindowInfo;
|
||||
import com.mogo.module.tanlu.model.event.ControlClickUpInfo;
|
||||
import com.mogo.module.tanlu.model.event.StartPlayInfo;
|
||||
import com.mogo.module.tanlu.model.event.VoiceControlUpInfo;
|
||||
import com.mogo.module.tanlu.util.ChartUtil;
|
||||
//import com.mogo.module.tanlu.video.SimpleCoverVideoPlayer;
|
||||
import com.mogo.module.tanlu.view.RoundLayout;
|
||||
import com.mogo.service.adas.IMogoADASControlStatusChangedListener;
|
||||
import com.mogo.service.analytics.IMogoAnalytics;
|
||||
import com.mogo.service.imageloader.IMogoImageloader;
|
||||
import com.mogo.service.imageloader.MogoImageView;
|
||||
import com.mogo.service.module.IMogoRegisterCenter;
|
||||
import com.mogo.skin.support.SkinMode;
|
||||
import com.mogo.utils.TipToast;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
//import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder;
|
||||
import com.zhidao.carchattingprovider.CallChattingProviderConstant;
|
||||
import com.zhidao.carchattingprovider.MogoDriverInfo;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static android.view.View.GONE;
|
||||
import static android.view.View.VISIBLE;
|
||||
import static com.mogo.module.tanlu.util.StringUitlKt.formatDate;
|
||||
import static com.mogo.module.tanlu.util.Utils.handleDistance;
|
||||
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description
|
||||
* @since 2020/3/11
|
||||
*/
|
||||
public class TanluSlideAdapterNew extends RecyclerView.Adapter<TanluSlideViewHolderNew> implements IMogoADASControlStatusChangedListener {
|
||||
private List<MarkerExploreWay> markerExploreWayList = new ArrayList<>();
|
||||
private static final String TAG = "TanluSlideAdapterNew";
|
||||
private Context mContext;
|
||||
|
||||
private TextView mAddressTv;
|
||||
private TextView mDistanceTv;
|
||||
private TextView mTimeTv;
|
||||
// private SimpleCoverVideoPlayer simpleCoverVideoPlayer;
|
||||
private MogoImageView autoZoomInImageView;
|
||||
private MogoImageView mHeadImage;
|
||||
private ImageView mChatImage;
|
||||
private ImageView mLikeImage;
|
||||
private LinearLayout mLikeLayout;
|
||||
private TextView mTypeTv;
|
||||
private IMogoImageloader mogoImageloader;
|
||||
private ImageView mCloseImage;
|
||||
private RoundLayout mRoundLayout;
|
||||
private ICarsChattingProvider mCarsChattingProvider;
|
||||
|
||||
//media
|
||||
// private GSYVideoOptionBuilder gsyVideoOptionBuilder = new GSYVideoOptionBuilder();
|
||||
private String mVideoUrl = "";
|
||||
private String mImageUrl = "";
|
||||
|
||||
//底层api
|
||||
private IMogoAnalytics mAnalytics;
|
||||
private TanluModelData mTanluModelData;
|
||||
|
||||
// private HashMap<Integer, SimpleCoverVideoPlayer> list = new HashMap<>();
|
||||
|
||||
|
||||
public TanluSlideAdapterNew(Context context, IMogoAnalytics analytics, TanluModelData tanluModelData, IMogoImageloader mogoImageloader,
|
||||
IMogoRegisterCenter mogoRegisterCenter) {
|
||||
this.mContext = context;
|
||||
this.mAnalytics = analytics;
|
||||
this.mTanluModelData = tanluModelData;
|
||||
this.mogoImageloader = mogoImageloader;
|
||||
mCarsChattingProvider = (ICarsChattingProvider) ARouter.getInstance().build(CallChattingProviderConstant.CAR_CALL_PROVIDER).navigation();
|
||||
mogoRegisterCenter.registerADASControlStatusChangedListener(TAG, this);
|
||||
|
||||
EventBus.getDefault().register(this);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public TanluSlideViewHolderNew onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View inflate = LayoutInflater.from(parent.getContext())
|
||||
.inflate(R.layout.tanlu_item_main_media_recycler_new, parent, false);
|
||||
return new TanluSlideViewHolderNew(inflate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull TanluSlideViewHolderNew holder, int position) {
|
||||
final MarkerExploreWay markerExploreWay = markerExploreWayList.get(position);
|
||||
if (markerExploreWay == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
mAddressTv = holder.itemView.findViewById(R.id.tv_information_media_content);
|
||||
mDistanceTv = holder.itemView.findViewById(R.id.tv_information_media_distance);
|
||||
mTimeTv = holder.itemView.findViewById(R.id.tv_information_media_time);
|
||||
// simpleCoverVideoPlayer = holder.itemView.findViewById(R.id.video_player_main);
|
||||
autoZoomInImageView = holder.itemView.findViewById(R.id.tanlu_photo_imageView);
|
||||
mHeadImage = holder.itemView.findViewById(R.id.tanlu_head_imageView);
|
||||
mChatImage = holder.itemView.findViewById(R.id.tanlu_chat_imageView);
|
||||
mLikeImage = holder.itemView.findViewById(R.id.tanlu_like_imageView);
|
||||
mLikeLayout = holder.itemView.findViewById(R.id.tanlu_like_layout);
|
||||
mTypeTv = holder.itemView.findViewById(R.id.tv_information_type);
|
||||
mCloseImage = holder.itemView.findViewById(R.id.tanlu_close_imageView);
|
||||
mRoundLayout = holder.itemView.findViewById(R.id.media_layout);
|
||||
|
||||
mCloseImage.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
EventBus.getDefault().post(new CloseWindowInfo());
|
||||
}
|
||||
});
|
||||
|
||||
//有可能不是一个对象
|
||||
// simpleCoverVideoPlayer.setVisibility(View.VISIBLE);
|
||||
autoZoomInImageView.setVisibility(View.GONE);
|
||||
|
||||
// list.put(position, simpleCoverVideoPlayer);
|
||||
|
||||
mTypeTv.setText(getTypeName(markerExploreWay.getPoiType()));
|
||||
if (markerExploreWay.getPoiType().equals(TanluConstants.TANLU_ROAD_CURRENT)) {
|
||||
mTypeTv.setBackgroundResource(R.drawable.tanlu_type_button_blue_bg);
|
||||
} else {
|
||||
mTypeTv.setBackgroundResource(R.drawable.tanlu_event_type_red_bg);
|
||||
}
|
||||
|
||||
mHeadImage.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
clickHead(markerExploreWay);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//自研车机
|
||||
if (DebugConfig.getCarMachineType() == 0) {
|
||||
if (markerExploreWay.getUserInfo() != null) {
|
||||
//是否能拨打
|
||||
ChartUtil.isCanCall(mContext.getApplicationContext(), b -> {
|
||||
Logger.d(TAG, " isCanCall b = " + b + " >>>sn =" + markerExploreWay.getUserInfo().getSn());
|
||||
if (b) {
|
||||
//对方是否在线
|
||||
ChartUtil.isOnLine(markerExploreWay.getUserInfo().getSn(), mContext.getApplicationContext(), b1 -> {
|
||||
Logger.d(TAG, " isonline b1 = " + b1 + " >>>sn =" + markerExploreWay.getUserInfo().getSn());
|
||||
if (b1) {
|
||||
mChatImage.setVisibility(VISIBLE);
|
||||
} else {
|
||||
mChatImage.setVisibility(GONE);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
mChatImage.setVisibility(GONE);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Logger.e(TAG, " markerExploreWay.getUserInfo() == null ");
|
||||
mChatImage.setVisibility(GONE);
|
||||
}
|
||||
}
|
||||
|
||||
//加载头像图片
|
||||
// RequestOptions requestOptions = new RequestOptions()
|
||||
// .circleCrop()
|
||||
// .placeholder(R.drawable.tanlu_head_image)
|
||||
// .error(R.drawable.tanlu_head_image)
|
||||
// .fallback(R.drawable.tanlu_head_image);
|
||||
// Glide.with(mContext)
|
||||
// .load(markerExploreWay.getUserInfo() != null ? markerExploreWay.getUserInfo().getUserHead() : "")
|
||||
// .apply(requestOptions)
|
||||
// .into(mHeadImage);
|
||||
if (mogoImageloader != null) {
|
||||
mogoImageloader.displayImage(markerExploreWay.getUserInfo() != null ? markerExploreWay.getUserInfo().getUserHead() : "", mHeadImage);
|
||||
}
|
||||
|
||||
//处理数据显示
|
||||
handleMarkerExploreWay(markerExploreWay);
|
||||
|
||||
mChatImage.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
traceTypeData(markerExploreWay.getInfoId() == null ? "" : markerExploreWay.getInfoId(), "2", markerExploreWay.getSn() == null ? "" : markerExploreWay.getSn());
|
||||
ChartUtil.callChatting(markerExploreWay.getUserInfo(), markerExploreWay.getLocation());
|
||||
}
|
||||
});
|
||||
|
||||
// mLikeLayout.setOnClickListener(new View.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(View v) {
|
||||
//动画
|
||||
// AnimatorSet animatorSet = (AnimatorSet) AnimatorInflater.loadAnimator(mContext, R.anim.v2x_like_heart_animation);
|
||||
// animatorSet.setTarget(mLikeImage);
|
||||
// animatorSet.addListener(new Animator.AnimatorListener() {
|
||||
// @Override
|
||||
// public void onAnimationStart(Animator animation) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onAnimationEnd(Animator animation) {
|
||||
// traceTypeData(markerExploreWay.getInfoId() == null ? "" : markerExploreWay.getInfoId(), "1", markerExploreWay.getSn() == null ? "" : markerExploreWay.getSn());
|
||||
// if (TextUtils.isEmpty(markerExploreWay.getInfoId())) {
|
||||
// TipToast.shortTip("点赞失败");
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// mTanluModelData.thumbsUp(markerExploreWay, new IThumbsUpCallback() {
|
||||
// @Override
|
||||
// public void onThumbsUpSuccess() {
|
||||
// TipToast.shortTip("点赞成功");
|
||||
// Logger.d(TAG, "onThumbsUpSuccess -------->");
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onThumbsUpFail() {
|
||||
// TipToast.shortTip("点赞失败");
|
||||
// Logger.e(TAG, "onThumbsUpFail -------->");
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onAnimationCancel(Animator animation) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onAnimationRepeat(Animator animation) {
|
||||
//
|
||||
// }
|
||||
// });
|
||||
// animatorSet.start();
|
||||
//
|
||||
// }
|
||||
// });
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void clickHead(MarkerExploreWay exploreWay) {
|
||||
MogoDriverInfo mogoDriverInfo = new MogoDriverInfo();
|
||||
int ageNumber = exploreWay.getUserInfo().getAgeNumber();
|
||||
mogoDriverInfo.setAge(ageNumber);
|
||||
String gender = exploreWay.getUserInfo().getGender();
|
||||
mogoDriverInfo.setGender(gender != null ? gender : null);
|
||||
String sn = exploreWay.getUserInfo().getSn();
|
||||
mogoDriverInfo.setSn(sn != null ? sn : "");
|
||||
String name = exploreWay.getUserInfo().getUserName();
|
||||
mogoDriverInfo.setUserName(name != null ? name : "");
|
||||
mogoDriverInfo.setUserHead(exploreWay.getUserInfo().getUserHead());
|
||||
mCarsChattingProvider.showUserWindow(TanluConstants.MODEL_NAME, mogoDriverInfo, mContext);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return markerExploreWayList == null ? 0 : markerExploreWayList.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
return super.getItemViewType(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置数据
|
||||
*
|
||||
* @param datas
|
||||
*/
|
||||
public void setDatas(List<MarkerExploreWay> datas) {
|
||||
if (markerExploreWayList != null) {
|
||||
markerExploreWayList.clear();
|
||||
|
||||
markerExploreWayList.addAll(datas);
|
||||
Logger.e(TAG, "setDatas size = " + markerExploreWayList.size());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通用的处理数据逻辑
|
||||
*
|
||||
* @param markerExploreWay
|
||||
*/
|
||||
private void handleMarkerExploreWay(MarkerExploreWay markerExploreWay) {
|
||||
if (markerExploreWay != null) {
|
||||
Logger.d(TAG, "markerExploreWay.getFileType() =" + markerExploreWay.getFileType());
|
||||
if (markerExploreWay.getFileType() == 0) { //图片
|
||||
refreshPhotoData(markerExploreWay);
|
||||
} else if (markerExploreWay.getFileType() == 1) { //视频
|
||||
refreshVideoData(markerExploreWay);
|
||||
}
|
||||
} else {
|
||||
Logger.e(TAG, "handleMarkerExploreWay == null");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新单个视频数据,更新位置positon
|
||||
*/
|
||||
private void refreshVideoData(MarkerExploreWay markerExploreWay) {
|
||||
// if (markerExploreWay.getItems() == null) {
|
||||
// showDefaultImage();
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// if (markerExploreWay.getItems().size() == 0) {
|
||||
// showDefaultImage();
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// String videoUrl = markerExploreWay.getItems().get(0).getUrl();
|
||||
// mImageUrl = markerExploreWay.getItems().get(0).getThumbnail();
|
||||
// Logger.d(TAG, "refreshVideoData mImageUrl = " + mImageUrl);
|
||||
// mAddressTv.setText(markerExploreWay.getAddr());
|
||||
// Logger.e(TAG, "refreshVideoData markerExploreWay.getAddr() = " + markerExploreWay.getAddr() + " >>>>videoUrl = " + videoUrl);
|
||||
// mDistanceTv.setText("距离" + handleDistance(markerExploreWay.getDistance()));
|
||||
// mTimeTv.setText(formatDate(markerExploreWay.getGenerateTime()));
|
||||
// //判断是图片还是视频,第一个时,上一个不可点击
|
||||
// autoZoomInImageView.setVisibility(View.GONE);
|
||||
//
|
||||
// //视频配置
|
||||
// mVideoUrl = videoUrl;
|
||||
// if (!TextUtils.isEmpty(videoUrl) && !TextUtils.isEmpty(mImageUrl)) {
|
||||
// autoZoomInImageView.setVisibility(View.GONE);
|
||||
// simpleCoverVideoPlayer.setVisibility(View.VISIBLE);
|
||||
// //加载封面图
|
||||
// simpleCoverVideoPlayer.loadCoverImage(mImageUrl, mContext);
|
||||
// gsyVideoOptionBuilder.setUrl(videoUrl).setCacheWithPlay(false).setPlayTag(TAG)
|
||||
// .build(simpleCoverVideoPlayer);
|
||||
// simpleCoverVideoPlayer.getStartButton().performClick();
|
||||
// } else {
|
||||
// simpleCoverVideoPlayer.setVisibility(GONE);
|
||||
// autoZoomInImageView.setVisibility(View.VISIBLE);
|
||||
// //加载图片
|
||||
//// RequestOptions requestOptions = new RequestOptions()
|
||||
//// .placeholder(R.drawable.tanlu_normal_image)
|
||||
//// .error(R.drawable.tanlu_normal_image);
|
||||
////
|
||||
//// Glide.with(mContext)
|
||||
//// .asBitmap()
|
||||
//// .load(mImageUrl)
|
||||
//// .apply(requestOptions)
|
||||
//// .into(new SkinAbleBitmapTarget(autoZoomInImageView, requestOptions));
|
||||
//
|
||||
// mogoImageloader.displayImage(mImageUrl, autoZoomInImageView);
|
||||
|
||||
// }
|
||||
//
|
||||
// traceVideoPlayStatusData();
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新单个图片数据
|
||||
*/
|
||||
private void refreshPhotoData(MarkerExploreWay markerExploreWay) {
|
||||
if (markerExploreWay.getItems() == null) {
|
||||
Logger.e(TAG, "refreshPhotoData markerExploreWay.getItems() == null");
|
||||
showDefaultImage();
|
||||
return;
|
||||
}
|
||||
|
||||
if (markerExploreWay.getItems().size() == 0) {
|
||||
Logger.e(TAG, "refreshPhotoData markerExploreWay.getItems().size() == 0");
|
||||
showDefaultImage();
|
||||
return;
|
||||
}
|
||||
|
||||
mAddressTv.setText(markerExploreWay.getAddr());
|
||||
mDistanceTv.setText("距离 " + handleDistance(markerExploreWay.getDistance()));
|
||||
mTimeTv.setText(formatDate(markerExploreWay.getGenerateTime()));
|
||||
String imageUrl = markerExploreWay.getItems().get(0).getUrl();
|
||||
// simpleCoverVideoPlayer.setVisibility(View.GONE);
|
||||
autoZoomInImageView.setVisibility(View.VISIBLE);
|
||||
Logger.d(TAG, "refreshPhotoData imageUrl = " + imageUrl);
|
||||
//加载图片
|
||||
// RequestOptions requestOptions = new RequestOptions()
|
||||
// .placeholder(R.drawable.tanlu_normal_image)
|
||||
// .error(R.drawable.tanlu_normal_image);
|
||||
// Glide.with(mContext)
|
||||
// .asBitmap()
|
||||
// .load(imageUrl)
|
||||
// .apply(requestOptions)
|
||||
// .into(new SkinAbleBitmapTarget(autoZoomInImageView, requestOptions));
|
||||
|
||||
mogoImageloader.displayImage(imageUrl, autoZoomInImageView);
|
||||
}
|
||||
|
||||
|
||||
private void showDefaultImage() {
|
||||
// simpleCoverVideoPlayer.setVisibility(View.GONE);
|
||||
autoZoomInImageView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传播放
|
||||
*/
|
||||
private void traceVideoPlayStatusData() {
|
||||
if (mAnalytics != null) {
|
||||
mAnalytics.track(TanluConstants.CARNET_USER_VIDEO_PLAY, null);
|
||||
}
|
||||
}
|
||||
|
||||
private void traceTypeData(String id, String type, String sn) {
|
||||
Map<String, Object> properties = new HashMap<>();
|
||||
properties.put("dbid", id);
|
||||
properties.put("type", type);
|
||||
properties.put("sn", sn);
|
||||
mAnalytics.track(TanluConstants.CARNET_ROAD_ENVENT, properties);
|
||||
}
|
||||
|
||||
/**
|
||||
* 上一条逻辑
|
||||
*/
|
||||
private void handlePrevious() {
|
||||
//判断是图片还是视频,第一个时,上一个不可点击
|
||||
Logger.d(TAG, " handlePrevious >> size= " + markerExploreWayList.size());
|
||||
EventBus.getDefault().post(new ControlClickUpInfo("1"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 下一条逻辑
|
||||
*/
|
||||
private void handleNext() {
|
||||
//判断是图片还是视频,最后一个时,下一个不可点击
|
||||
Logger.d(TAG, " handleNext >> size= " + markerExploreWayList.size());
|
||||
EventBus.getDefault().post(new ControlClickUpInfo("2"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param event
|
||||
*/
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onPushInfo(final VoiceControlUpInfo event) {
|
||||
Logger.d(TAG, "TanluSlideAdapter onPushInfo -----type = " + event.type);
|
||||
if (event.type.equals("1")) { //上一条
|
||||
handlePrevious();
|
||||
} else if (event.type.equals("2")) { //下一条
|
||||
handleNext();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 开始播放
|
||||
*/
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onHandlePlay(final StartPlayInfo info) {
|
||||
// int finalPosition = info.mPosition;
|
||||
// Logger.d(TAG, "onHandlePlay size = " + list.size() + " >> info.mPosition = " + info.mPosition + " >> finalPosition = " + finalPosition);
|
||||
//// if (list.size() > finalPosition) {
|
||||
// SimpleCoverVideoPlayer coverVideoPlayer = list.get(finalPosition);
|
||||
// coverVideoPlayer.release();
|
||||
// coverVideoPlayer.getStartButton().performClick();
|
||||
// traceVideoPlayStatusData();
|
||||
// }
|
||||
}
|
||||
|
||||
public void release() {
|
||||
// if (list != null) {
|
||||
// list.clear();
|
||||
// }
|
||||
}
|
||||
|
||||
private String getTypeName(String type) {
|
||||
String typeName = "";
|
||||
switch (type) {
|
||||
case TanluConstants.TANLU_TRAFFIC_CHECK_COMPAT:
|
||||
typeName = "交通检查";
|
||||
break;
|
||||
case TanluConstants.TANLU_ROAD_CLOSURE_COMPAT:
|
||||
typeName = "封路";
|
||||
break;
|
||||
case TanluConstants.TANLU_ROAD_CONSTRUCTION:
|
||||
typeName = "施工";
|
||||
break;
|
||||
case TanluConstants.TANLU_ROAD_CONGESTION_COMPAT:
|
||||
typeName = "拥堵";
|
||||
break;
|
||||
case TanluConstants.TANLU_ROAD_PONDING:
|
||||
typeName = "道路积水";
|
||||
break;
|
||||
case TanluConstants.TANLU_ROAD_ICING:
|
||||
typeName = "道路结冰";
|
||||
break;
|
||||
case TanluConstants.TANLU_ROAD_HEAVY_FOG:
|
||||
typeName = "浓雾";
|
||||
break;
|
||||
case TanluConstants.TANLU_ROAD_ACCIDENT:
|
||||
typeName = "交通事故";
|
||||
break;
|
||||
case TanluConstants.TANLU_ROAD_CURRENT:
|
||||
typeName = "实时路况";
|
||||
break;
|
||||
default:
|
||||
typeName = "实时路况";
|
||||
break;
|
||||
}
|
||||
return typeName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapUiModeChanged(EnumMapUI mapUI) {
|
||||
if ( mRoundLayout == null ) {
|
||||
return;
|
||||
}
|
||||
switch ( mapUI ) {
|
||||
case Type_Night:
|
||||
mRoundLayout.setBackgroundResource(R.drawable.shape_tanlu_top_bg);
|
||||
break;
|
||||
|
||||
case Type_Light:
|
||||
mRoundLayout.setBackgroundResource(R.drawable.shape_tanlu_top_bg_light);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCarStatusChanged(boolean visible) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
package com.mogo.module.tanlu.fragment.recycler;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description
|
||||
* @since 2020/3/11
|
||||
*/
|
||||
public class TanluSlideViewHolderNew extends RecyclerView.ViewHolder{
|
||||
|
||||
public TanluSlideViewHolderNew(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
package com.mogo.module.tanlu.model
|
||||
|
||||
import com.mogo.commons.data.BaseData
|
||||
|
||||
data class BaseDataCompat<T>(var result:T?):BaseData()
|
||||
@@ -1,17 +0,0 @@
|
||||
package com.mogo.module.tanlu.model
|
||||
|
||||
class CarsLive {
|
||||
var sn: String
|
||||
var lat: Double
|
||||
var lon: Double
|
||||
var direction: Int
|
||||
var canLive: Int
|
||||
|
||||
constructor(sn: String, lat: Double, lon: Double, direction: Int, canLive: Int) {
|
||||
this.sn = sn
|
||||
this.lat = lat
|
||||
this.lon = lon
|
||||
this.direction = direction
|
||||
this.canLive = canLive
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
package com.mogo.module.tanlu.model
|
||||
|
||||
/**
|
||||
* @description
|
||||
*
|
||||
* @author lixiaopeng
|
||||
* @since 2019-10-24
|
||||
*/
|
||||
data class Center (
|
||||
val lat: Double,//weidu
|
||||
val lon: Double
|
||||
)
|
||||
@@ -1,16 +0,0 @@
|
||||
package com.mogo.module.tanlu.model;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description
|
||||
* @since 2020-01-09
|
||||
*/
|
||||
public class End {
|
||||
public Double lat;
|
||||
public Double lon;
|
||||
|
||||
public End(Double lat, Double lon) {
|
||||
this.lat = lat;
|
||||
this.lon = lon;
|
||||
}
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
package com.mogo.module.tanlu.model;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import com.mogo.commons.data.BaseData;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description 列表数据
|
||||
* @since 2020-01-05
|
||||
*/
|
||||
public class Information extends BaseData implements Parcelable {
|
||||
public int type;
|
||||
public Double lon;
|
||||
public Double lat;
|
||||
public String addr;
|
||||
public Long generateTime;
|
||||
public String cityName;
|
||||
public ArrayList<Items> items;
|
||||
public int distance;
|
||||
public String nickName;
|
||||
public String headImgUrl;
|
||||
public String phone;
|
||||
public String trafficInfoType;
|
||||
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeInt(this.type);
|
||||
dest.writeValue(this.lon);
|
||||
dest.writeValue(this.lat);
|
||||
dest.writeString(this.addr);
|
||||
dest.writeValue(this.generateTime);
|
||||
dest.writeString(this.cityName);
|
||||
dest.writeTypedList(this.items);
|
||||
dest.writeInt(this.distance);
|
||||
dest.writeString(this.nickName);
|
||||
dest.writeString(this.headImgUrl);
|
||||
dest.writeString(this.phone);
|
||||
dest.writeString(this.trafficInfoType);
|
||||
}
|
||||
|
||||
public Information() {
|
||||
}
|
||||
|
||||
protected Information(Parcel in) {
|
||||
this.type = in.readInt();
|
||||
this.lon = (Double) in.readValue(Double.class.getClassLoader());
|
||||
this.lat = (Double) in.readValue(Double.class.getClassLoader());
|
||||
this.addr = in.readString();
|
||||
this.generateTime = (Long) in.readValue(Long.class.getClassLoader());
|
||||
this.cityName = in.readString();
|
||||
this.items = in.createTypedArrayList(Items.CREATOR);
|
||||
this.distance = in.readInt();
|
||||
this.nickName = in.readString();
|
||||
this.headImgUrl = in.readString();
|
||||
this.phone = in.readString();
|
||||
this.trafficInfoType = in.readString();
|
||||
}
|
||||
|
||||
public static final Creator<Information> CREATOR = new Creator<Information>() {
|
||||
@Override
|
||||
public Information createFromParcel(Parcel source) {
|
||||
return new Information(source);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Information[] newArray(int size) {
|
||||
return new Information[size];
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
package com.mogo.module.tanlu.model;
|
||||
|
||||
import com.mogo.commons.data.BaseData;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description
|
||||
* @since 2020-01-09
|
||||
*/
|
||||
public class InformationAndLiveCarResult extends BaseData {
|
||||
private Result onTheWayData;
|
||||
private Result infoMationResult;
|
||||
private Sns snResult;
|
||||
|
||||
public Result getOnTheWayData() {
|
||||
return onTheWayData;
|
||||
}
|
||||
|
||||
public void setOnTheWayData(Result onTheWayData) {
|
||||
this.onTheWayData = onTheWayData;
|
||||
}
|
||||
|
||||
public Result getInfoMationResult() {
|
||||
return infoMationResult;
|
||||
}
|
||||
|
||||
public void setInfoMationResult(Result infoMationResult) {
|
||||
this.infoMationResult = infoMationResult;
|
||||
}
|
||||
|
||||
public Sns getSnResult() {
|
||||
return snResult;
|
||||
}
|
||||
|
||||
public void setSnResult(Sns snResult) {
|
||||
this.snResult = snResult;
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
package com.mogo.module.tanlu.model
|
||||
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
|
||||
class Items(var url: String? = null, var thumbnail: String? = null) : Parcelable {
|
||||
constructor(parcel: Parcel) : this(
|
||||
parcel.readString(),
|
||||
parcel.readString()
|
||||
) {
|
||||
}
|
||||
|
||||
override fun writeToParcel(parcel: Parcel, flags: Int) {
|
||||
parcel.writeString(url)
|
||||
parcel.writeString(thumbnail)
|
||||
}
|
||||
|
||||
override fun describeContents(): Int {
|
||||
return 0
|
||||
}
|
||||
|
||||
companion object CREATOR : Parcelable.Creator<Items> {
|
||||
override fun createFromParcel(parcel: Parcel): Items {
|
||||
return Items(parcel)
|
||||
}
|
||||
|
||||
override fun newArray(size: Int): Array<Items?> {
|
||||
return arrayOfNulls(size)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
package com.mogo.module.tanlu.model
|
||||
|
||||
class LocationCarsWithRadius {
|
||||
var coordinates: List<Double>
|
||||
var radius: Int
|
||||
var type: String
|
||||
var keyWord: String? = null
|
||||
|
||||
constructor(coordinates: List<Double>, radius: Int, type: String, keyWord: String) {
|
||||
this.coordinates = coordinates
|
||||
this.radius = radius
|
||||
this.type = type
|
||||
this.keyWord = keyWord
|
||||
}
|
||||
|
||||
constructor(coordinates: List<Double>, radius: Int, type: String) {
|
||||
this.coordinates = coordinates
|
||||
this.radius = radius
|
||||
this.type = type
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package com.mogo.module.tanlu.model;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description
|
||||
* @since 2020-01-09
|
||||
*/
|
||||
public class NaviLatLng {
|
||||
public Start start;
|
||||
public End end;
|
||||
|
||||
NaviLatLng(Start start, End end) {
|
||||
this.start = start;
|
||||
this.end = end;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
package com.mogo.module.tanlu.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description
|
||||
* @since 2020-01-09
|
||||
*/
|
||||
public class NaviLatLngInfo implements Serializable {
|
||||
public String FromPoiLatitude = "";
|
||||
public String FromPoiLongitude = "";
|
||||
public String ToPoiLatitude = "";
|
||||
public String ToPoiLongitude= "";
|
||||
|
||||
public Start fromStart() {
|
||||
return new Start(Double.parseDouble(FromPoiLatitude), Double.parseDouble(FromPoiLongitude));
|
||||
}
|
||||
|
||||
public End toEnd() {
|
||||
return new End(Double.parseDouble(ToPoiLatitude), Double.parseDouble(ToPoiLongitude));
|
||||
}
|
||||
|
||||
public String getFromPoiLatitude() {
|
||||
return FromPoiLatitude;
|
||||
}
|
||||
|
||||
public void setFromPoiLatitude(String fromPoiLatitude) {
|
||||
FromPoiLatitude = fromPoiLatitude;
|
||||
}
|
||||
|
||||
public String getFromPoiLongitude() {
|
||||
return FromPoiLongitude;
|
||||
}
|
||||
|
||||
public void setFromPoiLongitude(String fromPoiLongitude) {
|
||||
FromPoiLongitude = fromPoiLongitude;
|
||||
}
|
||||
|
||||
public String getToPoiLatitude() {
|
||||
return ToPoiLatitude;
|
||||
}
|
||||
|
||||
public void setToPoiLatitude(String toPoiLatitude) {
|
||||
ToPoiLatitude = toPoiLatitude;
|
||||
}
|
||||
|
||||
public String getToPoiLongitude() {
|
||||
return ToPoiLongitude;
|
||||
}
|
||||
|
||||
public void setToPoiLongitude(String toPoiLongitude) {
|
||||
ToPoiLongitude = toPoiLongitude;
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
package com.mogo.module.tanlu.model
|
||||
|
||||
import java.io.Serializable
|
||||
|
||||
fun NaviLatLngInfo.fromStart(): Start {
|
||||
return Start(FromPoiLatitude.toDouble(), FromPoiLongitude.toDouble())
|
||||
}
|
||||
|
||||
fun NaviLatLngInfo.toEnd(): End {
|
||||
return End(ToPoiLatitude.toDouble(), ToPoiLongitude.toDouble())
|
||||
}
|
||||
|
||||
class NaviLatLngInfo1 : Serializable {
|
||||
var FromPoiLatitude: String = ""
|
||||
var FromPoiLongitude: String = ""
|
||||
var ToPoiLatitude: String = ""
|
||||
var ToPoiLongitude: String = ""
|
||||
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
package com.mogo.module.tanlu.model;
|
||||
|
||||
import com.mogo.commons.data.BaseData;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description 导航沿途数据
|
||||
* @since 2020-02-03
|
||||
*/
|
||||
public class NaviResult extends BaseData {
|
||||
|
||||
private Result result;
|
||||
|
||||
public Result getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(Result result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
public static class Result {
|
||||
private List<Information> informations;
|
||||
|
||||
public List<Information> getInformations() {
|
||||
return informations;
|
||||
}
|
||||
|
||||
public void setInformations(List<Information> informations) {
|
||||
this.informations = informations;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package com.mogo.module.tanlu.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description
|
||||
* @since 2020-02-03
|
||||
*/
|
||||
public class NaviRoadRequest {
|
||||
public List<String> coordinates;
|
||||
public int limit;
|
||||
|
||||
public NaviRoadRequest(List<String> coordinates, int limit) {
|
||||
this.coordinates = coordinates;
|
||||
this.limit = limit;
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
package com.mogo.module.tanlu.model;
|
||||
|
||||
import com.mogo.commons.data.BaseData;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description 通勤族划线
|
||||
* @since 2020-01-08
|
||||
*/
|
||||
public class PathLineResult extends BaseData {
|
||||
|
||||
private PathResult result;
|
||||
|
||||
public PathResult getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(PathResult result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
public static class PathResult {
|
||||
private List<Information> informations;
|
||||
private List<Center> pointList;
|
||||
|
||||
public List<Information> getInformations() {
|
||||
return informations;
|
||||
}
|
||||
|
||||
public void setInformations(List<Information> informations) {
|
||||
this.informations = informations;
|
||||
}
|
||||
|
||||
public List<Center> getPointList() {
|
||||
return pointList;
|
||||
}
|
||||
|
||||
public void setPointList(List<Center> pointList) {
|
||||
this.pointList = pointList;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package com.mogo.module.tanlu.model;
|
||||
|
||||
import com.mogo.commons.data.BaseData;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description
|
||||
* @since 2020-01-08
|
||||
*/
|
||||
public class Result extends BaseData {
|
||||
public List<Information> informations;
|
||||
|
||||
public List<Information> getInformations() {
|
||||
return informations;
|
||||
}
|
||||
|
||||
public void setInformations(List<Information> informations) {
|
||||
this.informations = informations;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
package com.mogo.module.tanlu.model
|
||||
|
||||
data class RoadInfoRequest(var location:Location,var poiTypes:Array<String>,var onlyFocus:Boolean = false,var onlySameCity:Boolean = false)
|
||||
|
||||
data class Location(var lat:Double,var lon:Double)
|
||||
@@ -1,6 +0,0 @@
|
||||
package com.mogo.module.tanlu.model
|
||||
|
||||
import com.mogo.commons.data.BaseData
|
||||
import com.mogo.module.common.entity.MarkerExploreWay
|
||||
|
||||
data class RoadInfos(var data:List<MarkerExploreWay>) : BaseData()
|
||||
@@ -1,10 +0,0 @@
|
||||
package com.mogo.module.tanlu.model
|
||||
|
||||
data class SearchOnlineInfo(
|
||||
val address: String,
|
||||
val cityId: String,
|
||||
val size: Int,
|
||||
// val radius: Int,
|
||||
val center: Center,
|
||||
val adcode: String
|
||||
)
|
||||
@@ -1,17 +0,0 @@
|
||||
package com.mogo.module.tanlu.model
|
||||
|
||||
|
||||
class Sns {
|
||||
|
||||
var sns: List<CarsLive>
|
||||
var localUserId: String
|
||||
var localNickName: String
|
||||
var localHeadImgUrl: String
|
||||
|
||||
constructor(sns: List<CarsLive>, localUserId: String, localNickName: String, localHeadImgUrl: String) {
|
||||
this.sns = sns
|
||||
this.localUserId = localUserId
|
||||
this.localNickName = localNickName
|
||||
this.localHeadImgUrl = localHeadImgUrl
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package com.mogo.module.tanlu.model;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description
|
||||
* @since 2020-01-09
|
||||
*/
|
||||
public class Start {
|
||||
public Double lat;
|
||||
public Double lon;
|
||||
|
||||
public Start(Double lat, Double lon) {
|
||||
this.lat = lat;
|
||||
this.lon = lon;
|
||||
}
|
||||
}
|
||||
@@ -1,559 +0,0 @@
|
||||
package com.mogo.module.tanlu.model;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.google.gson.Gson;
|
||||
import com.mogo.commons.data.BaseData;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.network.ParamsProvider;
|
||||
import com.mogo.commons.network.SubscribeImpl;
|
||||
import com.mogo.commons.network.Utils;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.map.search.geo.MogoPoiItem;
|
||||
import com.mogo.map.search.poisearch.IMogoPoiSearch;
|
||||
import com.mogo.map.search.poisearch.MogoPoiResult;
|
||||
import com.mogo.map.search.poisearch.query.MogoPoiSearchQuery;
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
import com.mogo.module.tanlu.callback.AlongTheWayCallback;
|
||||
import com.mogo.module.tanlu.callback.IThumbsUpCallback;
|
||||
import com.mogo.module.tanlu.callback.NaviCallback;
|
||||
import com.mogo.module.tanlu.callback.RoadInfoCallback;
|
||||
import com.mogo.module.tanlu.callback.RoadLineCallback;
|
||||
import com.mogo.module.tanlu.callback.UploadShareCallback;
|
||||
import com.mogo.module.tanlu.callback.VoiceSearchCallback;
|
||||
import com.mogo.module.tanlu.constant.HttpConst;
|
||||
import com.mogo.module.tanlu.constant.TanluConstants;
|
||||
import com.mogo.module.tanlu.fragment.TanluServiceManager;
|
||||
import com.mogo.module.tanlu.net.TanluApiService;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.map.IMogoMapService;
|
||||
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 com.mogo.utils.storage.SharedPrefsMgr;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.ObservableEmitter;
|
||||
import io.reactivex.ObservableOnSubscribe;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.functions.Function;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
import static com.mogo.commons.network.Utils.getSn;
|
||||
import static com.mogo.module.tanlu.constant.ConstKt.TYPE_NAME_BLOCK;
|
||||
import static com.mogo.module.tanlu.constant.TanluConstants.TANLU_ROAD_CONGESTION_COMPAT;
|
||||
import static com.mogo.module.tanlu.constant.TanluConstants.TANLU_ROAD_CURRENT;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description 探路接口数据处理
|
||||
* @since 2020-01-09
|
||||
*/
|
||||
public class TanluModelData {
|
||||
|
||||
private final Context mContext;
|
||||
private TanluApiService mTanluApiService;
|
||||
private static final String TAG = "TanluModelData";
|
||||
|
||||
public TanluModelData(Context context) {
|
||||
Logger.d(TAG, "TanluModelData ------->");
|
||||
this.mContext = context;
|
||||
IMogoNetwork network = (IMogoNetwork) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICES_NETWORK).navigation(context);
|
||||
mTanluApiService = network.create(TanluApiService.class, getBaseUrl());
|
||||
}
|
||||
|
||||
private String getBaseUrl() {
|
||||
if (DebugConfig.getNetMode() == DebugConfig.NET_MODE_RELEASE) {
|
||||
return HttpConst.HOST_PRODUCT;
|
||||
} else if (DebugConfig.getNetMode() == DebugConfig.NET_MODE_DEMO) {
|
||||
return HttpConst.HOST_SHOW;
|
||||
} else {
|
||||
return HttpConst.HOST_TEST;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 声音控制道理数据
|
||||
*/
|
||||
public void getVoiceControlRoadData(String keywords, String cityId, Double lon, Double lat,
|
||||
String adCode, final VoiceSearchCallback callback) {
|
||||
Gson gson = new Gson();
|
||||
SearchOnlineInfo searchOnlineInfo = new SearchOnlineInfo(keywords, cityId, 50, new Center(lat, lon), adCode);
|
||||
String searchInformationStr = gson.toJson(searchOnlineInfo);
|
||||
|
||||
List<Double> list = new ArrayList<>();
|
||||
list.add(lon);
|
||||
list.add(lat);
|
||||
LocationCarsWithRadius locCarsWithRadius = new LocationCarsWithRadius(list, 20000, "circle");
|
||||
String locCarsWithRadiusStr = gson.toJson(locCarsWithRadius);
|
||||
Logger.d(TAG, "getVoiceControlRoadData -------> " + getSn());
|
||||
|
||||
final Map<String, Object> params = new ParamsProvider.Builder(mContext)
|
||||
.append("sn", Utils.getSn())
|
||||
.append("data", searchInformationStr)
|
||||
.append("getSnData", locCarsWithRadiusStr)
|
||||
.build();
|
||||
mTanluApiService.searchOnLineInformation(params)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<VoiceSearchResult>(RequestOptions.create(mContext)) {
|
||||
@Override
|
||||
public void onSuccess(VoiceSearchResult o) {
|
||||
super.onSuccess(o);
|
||||
callback.onSuccess(o);
|
||||
Logger.d(TAG, "getVoiceControlRoadData onSuccess ------>");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
callback.onFail(message, code);
|
||||
Logger.e(TAG, "getVoiceControlRoadData onError message= " + message + ">>code =" + code);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
Logger.d(TAG, "getVoiceControlRoadData onError ------> e= " + e.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通勤族 事件,监听消息自己请求路线数据 ZD821C1933L00974 query.get("sn")
|
||||
*/
|
||||
public void getRoadLineData(final RoadLineCallback callback) {
|
||||
Logger.d(TAG, "getRoadLineData -------> =" + Utils.getSn());
|
||||
final Map<String, Object> params = new ParamsProvider.Builder(mContext)
|
||||
.append("sn", Utils.getSn())
|
||||
.build();
|
||||
|
||||
mTanluApiService.getRoadLineInfo(params)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<PathLineResult>(RequestOptions.create(mContext)) {
|
||||
@Override
|
||||
public void onSuccess(PathLineResult o) {
|
||||
super.onSuccess(o);
|
||||
callback.onSuccess(o);
|
||||
Logger.d(TAG, "getRoadLineData onSuccess ------>");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
callback.onFail(message, code);
|
||||
Logger.e(TAG, "getRoadLineData onError message= " + message + ">>code =" + code);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
e.printStackTrace();
|
||||
Logger.d(TAG, "getRoadLineData onError ------> e= " + e.getMessage());
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 导航路径,监听消息自己请求路线数据 ZD821C1933L00974
|
||||
*/
|
||||
public void getNaviRoadLineInfo(final RoadLineCallback callback) {
|
||||
Logger.d(TAG, "getNaviRoadLineInfo -------> =" + Utils.getSn());
|
||||
final Map<String, Object> params = new ParamsProvider.Builder(mContext)
|
||||
.append("sn", Utils.getSn())
|
||||
.build();
|
||||
|
||||
mTanluApiService.getNaviRoadLineInfo(params)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<PathLineResult>(RequestOptions.create(mContext)) {
|
||||
@Override
|
||||
public void onSuccess(PathLineResult o) {
|
||||
super.onSuccess(o);
|
||||
callback.onSuccess(o);
|
||||
Logger.d(TAG, "getNaviRoadLineInfo onSuccess ------>");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
callback.onFail(message, code);
|
||||
Logger.e(TAG, "getNaviRoadLineInfo onError message= " + message + ">>code =" + code);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
e.printStackTrace();
|
||||
Logger.d(TAG, "getNaviRoadLineInfo onError ------> e= " + e.getMessage());
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导航路线数据事件 TODO
|
||||
*/
|
||||
public void getNavigationLineData(Double lon, Double lat, final AlongTheWayCallback callback) {
|
||||
Gson gson = new Gson();
|
||||
NaviLatLng coordinates = new NaviLatLng(getNaviInfo(lon, lat).fromStart(), getNaviInfo(lon, lat).toEnd());
|
||||
Logger.d(TAG, "getNavigationLineData -------> " + getSn());
|
||||
|
||||
List<Double> list = new ArrayList<>();
|
||||
list.add(lon);
|
||||
list.add(lat);
|
||||
LocationCarsWithRadius locCarsWithRadius = new LocationCarsWithRadius(list, 20000, "circle");
|
||||
String locCarsWithRadiusStr = gson.toJson(locCarsWithRadius);
|
||||
|
||||
final Map<String, Object> params = new ParamsProvider.Builder(mContext)
|
||||
.append("onTheWayData", gson.toJson(coordinates))
|
||||
.append("getSnData", locCarsWithRadiusStr)
|
||||
.build();
|
||||
|
||||
mTanluApiService.requestInformationAlongTheWay(Utils.getSn(), params)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<InformationAndLiveCarResult>(RequestOptions.create(mContext)) {
|
||||
@Override
|
||||
public void onSuccess(InformationAndLiveCarResult data) {
|
||||
super.onSuccess(data);
|
||||
callback.onSuccess(data);
|
||||
Logger.d(TAG, "getNavigationLineData onSuccess ------>");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
callback.onFail(message, code);
|
||||
Logger.e(TAG, "getNavigationLineData onError message= " + message + ">>code =" + code);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
Logger.d(TAG, "getNavigationLineData onError ------> e= " + e.getMessage());
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取Location,如果没有location数据为空,则使用首次或者上次定位点,并且更新SP,需要抽取公共方法
|
||||
*/
|
||||
public NaviLatLngInfo getNaviInfo(Double lon, Double lat) {
|
||||
String naviInfo = SharedPrefsMgr.getInstance(mContext).getString(TanluConstants.NAVI_INFO);
|
||||
Logger.d(TAG, " getNaviInfo naviInfo =" + naviInfo);
|
||||
NaviLatLngInfo naviLatLngInfo = new Gson().fromJson(naviInfo, NaviLatLngInfo.class);
|
||||
Logger.d(TAG, "getLocNaviInfo lat = $lat -----> lon = $lon");
|
||||
if (naviLatLngInfo != null) {
|
||||
if (lon == 0.0 || lat == 0.0) {
|
||||
return naviLatLngInfo;
|
||||
} else {
|
||||
naviLatLngInfo.setFromPoiLatitude(lat + "");
|
||||
naviLatLngInfo.setFromPoiLongitude(lon + "");
|
||||
SharedPrefsMgr.getInstance(mContext).putString(TanluConstants.NAVI_INFO, new Gson().toJson(naviLatLngInfo));
|
||||
return naviLatLngInfo;
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 上报交通检查和封路
|
||||
*/
|
||||
public void addTrafficCheckInfo(String poiType, String poiImgUrl, String nickname, String headImgUrl,
|
||||
double lat, double lon, String address, float direction, final UploadShareCallback callback) {
|
||||
Gson gson = new Gson();
|
||||
UploadShareRoadInfo uploadShareRoadInfo = new UploadShareRoadInfo(poiType, poiImgUrl, nickname, headImgUrl, new Center(lat, lon), address, direction);
|
||||
String uploadShareStr = gson.toJson(uploadShareRoadInfo);
|
||||
Logger.d(TAG, "addTrafficCheckInfo sn= " + getSn() + ">> uploadShareStr =" + uploadShareStr);
|
||||
final Map<String, Object> params = new ParamsProvider.Builder(mContext)
|
||||
.append("sn", Utils.getSn())
|
||||
.append("data", uploadShareStr)
|
||||
.build();
|
||||
mTanluApiService.uploadCheckTrafficInfor(params)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create(mContext)) {
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
super.onSuccess(o);
|
||||
callback.onSuccess(o);
|
||||
Logger.d(TAG, "addTrafficCheckInfo onSuccess ------>");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
callback.onFail(message, code);
|
||||
Logger.e(TAG, "addTrafficCheckInfo onError message= " + message + ">>code =" + code);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
e.printStackTrace();
|
||||
Logger.d(TAG, "addTrafficCheckInfo onError ------> e= " + e.getMessage());
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 上报可能错误的数据,server删除
|
||||
*/
|
||||
public void uploadDeleteErrorDataInfo(String id, String poiType, String updateType, final UploadShareCallback callback) {
|
||||
Gson gson = new Gson();
|
||||
UploadErrorDataInfo uploadErrorDataInfo = new UploadErrorDataInfo(id, poiType, updateType);
|
||||
String uploadShareStr = gson.toJson(uploadErrorDataInfo);
|
||||
|
||||
Logger.d(TAG, "uploadDeleteErrorDataInfo sn= " + getSn() + ">> uploadShareStr =" + uploadShareStr);
|
||||
final Map<String, Object> params = new ParamsProvider.Builder(mContext)
|
||||
.append("sn", Utils.getSn())
|
||||
.append("data", uploadShareStr)
|
||||
.build();
|
||||
|
||||
mTanluApiService.uploadDeleteErrorData(params)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create(mContext)) {
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
super.onSuccess(o);
|
||||
callback.onSuccess(o);
|
||||
Logger.d(TAG, "uploadDeleteErrorDataInfo onSuccess ------>");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
callback.onFail(message, code);
|
||||
Logger.e(TAG, "uploadDeleteErrorDataInfo onError message= " + message + ">>code =" + code);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
e.printStackTrace();
|
||||
Logger.d(TAG, "uploadDeleteErrorDataInfo onError ------> e= " + e.getMessage());
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 组装需要的请求list
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private List<String> getLatLngRequest(List<MogoLatLng> latLnglist) {
|
||||
List<String> resultList = new ArrayList<>();
|
||||
for (int i = 0; i < latLnglist.size(); i++) {
|
||||
resultList.add(latLnglist.get(i).lng + "," + latLnglist.get(i).lat);
|
||||
}
|
||||
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取导航沿途情报
|
||||
*/
|
||||
public void getNaviInformation(List<MogoLatLng> mogoLatLnglist, final NaviCallback callback) {
|
||||
Gson gson = new Gson();
|
||||
if (mogoLatLnglist == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
NaviRoadRequest naviRoadRequest = new NaviRoadRequest(getLatLngRequest(mogoLatLnglist), 10);
|
||||
String naviStr = gson.toJson(naviRoadRequest);
|
||||
Logger.d(TAG, "getNaviInformation naviStr = " + naviStr);
|
||||
final Map<String, Object> params = new ParamsProvider.Builder(mContext)
|
||||
.append("sn", Utils.getSn())
|
||||
.append("data", naviStr)
|
||||
.build();
|
||||
|
||||
mTanluApiService.getNaviInformation(params)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<NaviResult>(RequestOptions.create(mContext)) {
|
||||
@Override
|
||||
public void onSuccess(NaviResult o) {
|
||||
super.onSuccess(o);
|
||||
callback.onSuccess(o);
|
||||
Logger.d(TAG, "getNaviInformation onSuccess ------>");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
callback.onFail(message, code);
|
||||
Logger.e(TAG, "getNaviInformation onError message= " + message + ">>code =" + code);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
e.printStackTrace();
|
||||
Logger.d(TAG, "getNaviInformation onError ------> e= " + e.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询周边道路事件,是通过语音搜索,然后根据语音提供的语义,从服务端查询道路事件
|
||||
*
|
||||
* @param voiceCmdData 语音提供的语义封装
|
||||
*/
|
||||
public void queryRodeInfo(final VoiceCmdData voiceCmdData, final RoadInfoCallback callback) {
|
||||
Logger.d(TAG, "queryRodeInfo: " + voiceCmdData);
|
||||
if (voiceCmdData.isHere()) {
|
||||
// 搜索附近路况,只需要拿到当前位置信息,就可以请求服务端
|
||||
MogoLocation l = TanluServiceManager.getServiceApis().getMapServiceApi().getSingletonLocationClient(mContext).getLastKnowLocation();
|
||||
Location location = new Location(l.getLatitude(), l.getLongitude());
|
||||
callback.onLocatSuccess(l.getLatitude(), l.getLongitude());
|
||||
RoadInfoRequest request;
|
||||
if (voiceCmdData.getObj().equals(TYPE_NAME_BLOCK)) {
|
||||
// 拥堵和路况同时查
|
||||
request = new RoadInfoRequest(location, new String[]{TANLU_ROAD_CONGESTION_COMPAT, TANLU_ROAD_CURRENT}, false, false);
|
||||
}else{
|
||||
request = new RoadInfoRequest(location, new String[]{voiceCmdData.getType()}, false, false);
|
||||
}
|
||||
|
||||
Map<String, Object> params = new ParamsProvider.Builder(mContext)
|
||||
.append("sn", Utils.getSn())
|
||||
.append("data", GsonUtil.jsonFromObject(request))
|
||||
.build();
|
||||
|
||||
mTanluApiService.queryRoadInfos(params)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<BaseDataCompat<RoadInfos>>(RequestOptions.create(mContext)) {
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(BaseDataCompat<RoadInfos> o) {
|
||||
super.onSuccess(o);
|
||||
Logger.d(TAG, "搜索附近路况信息成功: " + o);
|
||||
callback.onQueryRoadInfoSuccess(o.getResult().getData());
|
||||
Logger.d(TAG, "搜索附近路况信息成功2: " + o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
callback.onQueryRoadInfoFail(message, code);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// 查询的不是附近的信息,所以需要查询一下目标地址的经纬度,然后再请求服务端
|
||||
Observable.create(new ObservableOnSubscribe<MogoPoiResult>() {
|
||||
@Override
|
||||
public void subscribe(ObservableEmitter<MogoPoiResult> emitter) throws Exception {
|
||||
// 根据传入的地址,转成经纬度
|
||||
IMogoMapService mapService = TanluServiceManager.getServiceApis().getMapServiceApi();
|
||||
String cityCode = mapService.getSingletonLocationClient(mContext).getLastKnowLocation().getCityCode();
|
||||
MogoPoiSearchQuery poiSearchQuery = new MogoPoiSearchQuery(voiceCmdData.getLocation(), "", cityCode);
|
||||
IMogoPoiSearch poiSearch = mapService.getPoiSearch(mContext, poiSearchQuery);
|
||||
MogoPoiResult result = poiSearch.searchPOI();
|
||||
if (result != null && result.getPois() != null && result.getPois().size() > 0) {
|
||||
emitter.onNext(result);
|
||||
} else {
|
||||
emitter.onError(new IllegalArgumentException("没有根据地址查询到对应的经纬度"));
|
||||
}
|
||||
}
|
||||
}).subscribeOn(Schedulers.io()).observeOn(Schedulers.io())
|
||||
.flatMap(new Function<MogoPoiResult, Observable<BaseDataCompat<RoadInfos>>>() {
|
||||
@Override
|
||||
public Observable<BaseDataCompat<RoadInfos>> apply(MogoPoiResult mogoPoiResult) throws Exception {
|
||||
// 转成经纬度后,整理参数,进行接口请求
|
||||
Logger.d(TAG, "查询目标地址经纬度成功===" + Thread.currentThread().getName());
|
||||
MogoPoiItem poiItem = mogoPoiResult.getPois().get(0);
|
||||
Location location = new Location(poiItem.getPoint().lat, poiItem.getPoint().lon);
|
||||
callback.onLocatSuccess(location.getLat(), location.getLon());
|
||||
RoadInfoRequest request;
|
||||
if (voiceCmdData.getObj().equals(TYPE_NAME_BLOCK)) {
|
||||
// 拥堵和路况同时查
|
||||
request = new RoadInfoRequest(location, new String[]{TANLU_ROAD_CONGESTION_COMPAT, TANLU_ROAD_CURRENT}, false, false);
|
||||
}else{
|
||||
request = new RoadInfoRequest(location, new String[]{voiceCmdData.getType()}, false, false);
|
||||
}
|
||||
|
||||
Map<String, Object> params = new ParamsProvider.Builder(mContext)
|
||||
.append("sn", Utils.getSn())
|
||||
.append("data", GsonUtil.jsonFromObject(request))
|
||||
.build();
|
||||
return mTanluApiService.queryRoadInfos(params);
|
||||
}
|
||||
}).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<BaseDataCompat<RoadInfos>>(RequestOptions.create(mContext)) {
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
callback.onQueryRoadInfoFail(e.getMessage(), -1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(BaseDataCompat<RoadInfos> o) {
|
||||
super.onSuccess(o);
|
||||
Logger.d(TAG, "当前线程为"+Thread.currentThread().getName()+" 搜索目标地址路况信息成功: " + o);
|
||||
callback.onQueryRoadInfoSuccess(o.getResult().getData());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
callback.onQueryRoadInfoFail(message, code);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 点赞接口
|
||||
*/
|
||||
public void thumbsUp(MarkerExploreWay marker, final IThumbsUpCallback callback) {
|
||||
ThumbsUpRequest request = new ThumbsUpRequest(Utils.getSn(), null, marker.getPoiType(), marker.getInfoId());
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
|
||||
params.put("data", GsonUtil.jsonFromObject(request));
|
||||
mTanluApiService.addLikes(params).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new SubscribeImpl<BaseDataCompat<String>>(RequestOptions.create(mContext)) {
|
||||
@Override
|
||||
public void onSuccess(BaseDataCompat<String> o) {
|
||||
super.onSuccess(o);
|
||||
callback.onThumbsUpSuccess();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
callback.onThumbsUpFail();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
callback.onThumbsUpFail();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package com.mogo.module.tanlu.model;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description
|
||||
* @since 2020/7/29
|
||||
*/
|
||||
public class Test {
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package com.mogo.module.tanlu.model
|
||||
|
||||
data class ThumbsUpRequest(
|
||||
var sn: String,
|
||||
var userId: String?,
|
||||
var poiType: String,
|
||||
var infoId: String
|
||||
)
|
||||
@@ -1,18 +0,0 @@
|
||||
package com.mogo.module.tanlu.model;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description 分享上报错误信息参数
|
||||
* @since 2020-01-16
|
||||
*/
|
||||
public class UploadErrorDataInfo {
|
||||
public String id;
|
||||
public String poiType;
|
||||
public String updateType;
|
||||
|
||||
public UploadErrorDataInfo(String id, String poiType, String updateType) {
|
||||
this.id = id;
|
||||
this.poiType = poiType;
|
||||
this.updateType = updateType;
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package com.mogo.module.tanlu.model;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description 分享上报信息参数
|
||||
* @since 2020-01-16
|
||||
*/
|
||||
public class UploadShareRoadInfo {
|
||||
|
||||
public String poiType;
|
||||
public String poiImgUrl;
|
||||
public String nickname;
|
||||
public String headImgUrl;
|
||||
public float direction;
|
||||
private Center location;
|
||||
private String address;
|
||||
|
||||
public UploadShareRoadInfo(String poiType, String poiImgUrl, String nickname,
|
||||
String headImgUrl, Center location, String address, float direction) {
|
||||
this.poiType = poiType;
|
||||
this.poiImgUrl = poiImgUrl;
|
||||
this.nickname = nickname;
|
||||
this.headImgUrl = headImgUrl;
|
||||
this.location = location;
|
||||
this.address = address;
|
||||
this.direction = direction;
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
package com.mogo.module.tanlu.model
|
||||
|
||||
import com.mogo.module.tanlu.constant.*
|
||||
import com.mogo.module.tanlu.constant.TanluConstants.*
|
||||
|
||||
/**
|
||||
* 语音指令附带数据,目前只针对道路事件查询 */
|
||||
class VoiceCmdData(var op: String, var location: String, var obj: String) {
|
||||
|
||||
/**
|
||||
* 将obj转成服务端可识别的道路事件类型
|
||||
*/
|
||||
val type: String
|
||||
get() {
|
||||
return when (obj) {
|
||||
TYPE_NAME_BLOCK -> TANLU_ROAD_CONGESTION_COMPAT
|
||||
TYPE_NAME_TRAFFIC_CHECK -> TANLU_TRAFFIC_CHECK_COMPAT
|
||||
TYPE_NAME_CLOSURE -> TANLU_ROAD_CLOSURE_COMPAT
|
||||
TYPE_NAME_ACCIDENT -> TANLU_ROAD_ACCIDENT
|
||||
TYPE_NAME_REAL_TIME_TRAFFIC -> TANLU_ROAD_CURRENT
|
||||
TYPE_NAME_STAGNANT_WATER -> TANLU_ROAD_PONDING
|
||||
TYPE_NAME_ROAD_ICY -> TANLU_ROAD_ICING
|
||||
TYPE_NAME_DENSE_FOG -> TANLU_ROAD_HEAVY_FOG
|
||||
TYPE_NAME_ROAD_CONSTRUCTION -> TANLU_ROAD_CONSTRUCTION
|
||||
else -> ""
|
||||
}
|
||||
}
|
||||
|
||||
fun isHere(): Boolean {
|
||||
return "附近" == location
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return "VoiceCmdData(op='$op', location='$location', obj='$obj', type='$type')"
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
package com.mogo.module.tanlu.model;
|
||||
|
||||
import com.mogo.commons.data.BaseData;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description 声音控制接口
|
||||
* @since 2020-01-08
|
||||
*/
|
||||
public class VoiceSearchResult extends BaseData {
|
||||
|
||||
private Result result;
|
||||
|
||||
public Result getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(Result result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
public static class Result {
|
||||
private List<Information> informations;
|
||||
private String description;
|
||||
private Sns snResult;
|
||||
|
||||
public List<Information> getInformations() {
|
||||
return informations;
|
||||
}
|
||||
|
||||
public void setInformations(List<Information> informations) {
|
||||
this.informations = informations;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public Sns getSnResult() {
|
||||
return snResult;
|
||||
}
|
||||
|
||||
public void setSnResult(Sns snResult) {
|
||||
this.snResult = snResult;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.mogo.module.tanlu.model.event;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description push区分类别
|
||||
* @since 2020-01-08
|
||||
*/
|
||||
public class CloseWindowInfo implements Serializable {
|
||||
|
||||
public CloseWindowInfo() {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package com.mogo.module.tanlu.model.event;
|
||||
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description 上下按钮事件
|
||||
* @since 2020-01-08
|
||||
*/
|
||||
public class ControlClickUpInfo {
|
||||
public String type;
|
||||
|
||||
public ControlClickUpInfo(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
package com.mogo.module.tanlu.model.event;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description 错误数据id和type
|
||||
* @since 2020-01-08
|
||||
*/
|
||||
public class DataErrorInfo implements Serializable {
|
||||
public String id; //封路,还是上报
|
||||
public String poiType;
|
||||
public String updateType;
|
||||
|
||||
public DataErrorInfo(String id, String poiType, String updateType) {
|
||||
this.id = id;
|
||||
this.poiType = poiType;
|
||||
this.updateType = updateType;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package com.mogo.module.tanlu.model.event;
|
||||
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description 空数据
|
||||
* @since 2020-03-12
|
||||
*/
|
||||
public class EmptyData {
|
||||
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.mogo.module.tanlu.model.event;
|
||||
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description 获取数据失败
|
||||
* @since 2020-01-08
|
||||
*/
|
||||
public class GetInfoError {
|
||||
public String type;
|
||||
|
||||
public GetInfoError(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
package com.mogo.module.tanlu.model.event;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description marker数据
|
||||
* @since 2020-01-08
|
||||
*/
|
||||
public class MarkerInfo implements Serializable {
|
||||
public String type; //封路,还是上报
|
||||
public String fromType; //来源 主动,被动,策略。
|
||||
public String imageUrl; //上传完cos图片
|
||||
public double lon; //经度
|
||||
public double lat; //纬度
|
||||
public boolean isCumtom; //是否主动上报
|
||||
|
||||
public MarkerInfo(String type, String imageUrl, double lon, double lat, boolean isCumtom, String fromType) {
|
||||
this.type = type;
|
||||
this.imageUrl = imageUrl;
|
||||
this.lon = lon;
|
||||
this.lat = lat;
|
||||
this.isCumtom = isCumtom;
|
||||
this.fromType = fromType;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package com.mogo.module.tanlu.model.event;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description push区分类别
|
||||
* @since 2020-01-08
|
||||
*/
|
||||
public class PushTypeInfo implements Serializable {
|
||||
public String type;
|
||||
|
||||
public PushTypeInfo(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package com.mogo.module.tanlu.model.event;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description 分享弹框事件
|
||||
* @since 2020-01-08
|
||||
*/
|
||||
public class SharedialogEvent {
|
||||
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package com.mogo.module.tanlu.model.event;
|
||||
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description 开始播放
|
||||
* @since 2020-03-11
|
||||
*/
|
||||
public class StartPlayInfo {
|
||||
public int mPosition;
|
||||
|
||||
public StartPlayInfo(int position) {
|
||||
this.mPosition = position;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package com.mogo.module.tanlu.model.event;
|
||||
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description
|
||||
* @since 2020/3/11
|
||||
*/
|
||||
public class TanluMarkerEvent {
|
||||
public MarkerExploreWay markerExploreWay;
|
||||
|
||||
public TanluMarkerEvent(MarkerExploreWay exploreWay) {
|
||||
this.markerExploreWay = exploreWay;
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package com.mogo.module.tanlu.model.event;
|
||||
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description marker数据
|
||||
* @since 2020-01-08
|
||||
*/
|
||||
public class VoiceControlUpInfo {
|
||||
public String type;
|
||||
|
||||
public VoiceControlUpInfo(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.mogo.module.tanlu.model.global
|
||||
|
||||
import com.mogo.module.tanlu.model.Information
|
||||
import java.util.ArrayList
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-02
|
||||
*
|
||||
* 共享的情报列表,避免在点击大屏查看视频时intent序列化造成的开销
|
||||
*/
|
||||
object GlobalSharedInformation {
|
||||
|
||||
var informationList: ArrayList<Information>? = null
|
||||
}
|
||||
@@ -1,96 +0,0 @@
|
||||
package com.mogo.module.tanlu.net;
|
||||
|
||||
import com.mogo.commons.data.BaseData;
|
||||
import com.mogo.module.tanlu.model.BaseDataCompat;
|
||||
import com.mogo.module.tanlu.model.InformationAndLiveCarResult;
|
||||
import com.mogo.module.tanlu.model.NaviResult;
|
||||
import com.mogo.module.tanlu.model.PathLineResult;
|
||||
import com.mogo.module.tanlu.model.RoadInfos;
|
||||
import com.mogo.module.tanlu.model.VoiceSearchResult;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.Single;
|
||||
import retrofit2.http.Field;
|
||||
import retrofit2.http.FieldMap;
|
||||
import retrofit2.http.FormUrlEncoded;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description 探路相关接口定义
|
||||
* @since 2020-01-07
|
||||
*/
|
||||
public interface TanluApiService {
|
||||
|
||||
/**
|
||||
* 探路沿途数据,只是为了通知server下发push
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("deva/car/path/no/getOnTheWayDataAndSn/v1")
|
||||
Observable<InformationAndLiveCarResult> requestInformationAlongTheWay(@Query("sn") String sn, @FieldMap Map<String, Object> parameters);
|
||||
|
||||
/**
|
||||
* 获取上班族路线的坐标集
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("yycp-travel-condition/travelDetail/info/no/commuter/v1")
|
||||
Observable<PathLineResult> getRoadLineInfo(@FieldMap Map<String, Object> infoBody);
|
||||
|
||||
/**
|
||||
* 获取导航路线的坐标集
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("deva/car/path/no/getOnWayPushData/v1")
|
||||
Observable<PathLineResult> getNaviRoadLineInfo(@FieldMap Map<String, Object> infoBody);
|
||||
|
||||
/**
|
||||
* 基于地理信息词缀的空间情报检索
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("deva/car/search/no/searchInforationByAddress/v1")
|
||||
Observable<VoiceSearchResult> searchOnLineInformation(@FieldMap Map<String, Object> infoBody);
|
||||
|
||||
/**
|
||||
* 上报交通检查,封路
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("deva/car/poi/no/addNovelty/v1")
|
||||
Observable<BaseData> uploadCheckTrafficInfor(@FieldMap Map<String, Object> infoBody);
|
||||
|
||||
/**
|
||||
* 导航沿途情报
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("deva/car/search/no/searchInforationByCoordinates/v1")
|
||||
Observable<NaviResult> getNaviInformation(@FieldMap Map<String, Object> infoBody);
|
||||
|
||||
/**
|
||||
* 纠错
|
||||
* 交通检查 10002
|
||||
* 封路 10003
|
||||
* 拥堵 10007
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("deva/car/poi/no/carPoiErrorRecovery/v1")
|
||||
Observable<BaseData> uploadDeleteErrorData(@FieldMap Map<String, Object> infoBody);
|
||||
|
||||
/**
|
||||
* 查询(搜索)道路事件信息
|
||||
* 接口文档:http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=42305842
|
||||
* 文档中有些参数暂时没有用到,包括radius,limit
|
||||
* @return
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("/yycp-launcherSnapshot/launcherSnapshot/searchRoadEventsSync")
|
||||
Observable<BaseDataCompat<RoadInfos>> queryRoadInfos(@FieldMap Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 点赞接口
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("/deva/poiInfoFabulous/car/poi/no/addPoiInfoFabulous/v1")
|
||||
Observable<BaseDataCompat<String>> addLikes(@FieldMap Map<String, Object> params);
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
package com.mogo.module.tanlu.receiver;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.module.tanlu.model.event.DataErrorInfo;
|
||||
import com.mogo.module.tanlu.model.event.SharedialogEvent;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description 数据失效后收到的广播
|
||||
* @since 2020-02-09
|
||||
*/
|
||||
public class DataErrorReceiver extends BroadcastReceiver {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
Log.d("DataErrorReceiver", "intent.getAction() = " + intent.getAction());
|
||||
if (intent.getAction() == "com.zhidao.tanlu.dataerror") {
|
||||
String id = intent.getStringExtra("id");
|
||||
String poiType = intent.getStringExtra("type");
|
||||
String updateType = intent.getStringExtra("updateType");
|
||||
Log.d("DataErrorReceiver", "id = " + id + " >>> poiType = " + poiType + " >>updateType = " + updateType);
|
||||
EventBus.getDefault().post(new DataErrorInfo(id, poiType, updateType));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package com.mogo.module.tanlu.receiver
|
||||
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.util.Log
|
||||
import com.mogo.module.tanlu.model.event.GetInfoError
|
||||
import com.mogo.module.tanlu.model.event.MarkerInfo
|
||||
import com.mogo.module.tanlu.model.event.PushTypeInfo
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
|
||||
/**
|
||||
* 摄像头获取数据失败
|
||||
*/
|
||||
class GetInfoFailedReceiver : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
Log.d("GetInfoFailedReceiver", "-----1-------");
|
||||
if (intent.action == "com.zhidao.roadcondition.getinfo.failed"){
|
||||
var type = intent.getStringExtra("type")
|
||||
Log.d("GetInfoFailedReceiver", " ---2---- type = $type")
|
||||
EventBus.getDefault().post(GetInfoError(type))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
package com.mogo.module.tanlu.receiver
|
||||
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.util.Log
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.module.tanlu.model.event.MarkerInfo
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
|
||||
/**
|
||||
* marker数据接收
|
||||
*/
|
||||
class MarkerInfoReceiver : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
// if (intent.action == "com.zhidao.roadcondition.marker.info"){
|
||||
// var type = intent.getStringExtra("type")
|
||||
// var fromType = intent.getStringExtra("fromType")
|
||||
// var imageUrl = intent.getStringExtra("imageUrl")
|
||||
// var lat = intent.getDoubleExtra("lat",0.0)
|
||||
// var lon = intent.getDoubleExtra("lon",0.0) //经度
|
||||
// var custom = intent.getBooleanExtra("custom", false)
|
||||
// Log.d("MarkerInfoReceiver", "type =" + type + "---->lat =" + lat + "----lon =" + lon + " --custom = " + custom + "---imageUrl =" + imageUrl)
|
||||
// EventBus.getDefault().post(MarkerInfo(type, imageUrl, lon, lat, custom, fromType))
|
||||
// }
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package com.mogo.module.tanlu.receiver
|
||||
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.util.Log
|
||||
import com.mogo.module.tanlu.model.event.PushTypeInfo
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
|
||||
/**
|
||||
* 导航和通勤族 push的action
|
||||
*/
|
||||
class PushReceiver : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
if (intent.action == "com.zhidao.roadcondition.split"){
|
||||
var uri = Uri.parse(intent.getStringExtra("uri"))
|
||||
Log.d("PushReceiver", "uri = $uri")
|
||||
EventBus.getDefault().post(PushTypeInfo(uri.getQueryParameter("type")))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
package com.mogo.module.tanlu.receiver
|
||||
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import com.mogo.module.tanlu.constant.*
|
||||
import com.mogo.module.tanlu.constant.TanluConstants.SPECIFIEDROAD_SEARCH
|
||||
import com.mogo.module.tanlu.model.VoiceCmdData
|
||||
import com.mogo.module.tanlu.util.Utils
|
||||
import com.mogo.utils.logger.Logger
|
||||
|
||||
class SearchTrafficInfoReceiver : BroadcastReceiver() {
|
||||
private val TAG = "SearchTrafficInfoReceiver"
|
||||
override fun onReceive(context: Context?, intent: Intent?) {
|
||||
// 目前只接com.zhidao.speech.awake.notify这一个广播,所以暂不区分action
|
||||
Logger.d(TAG,"收到搜索事件广播====")
|
||||
val data = intent?.getStringExtra("data") ?: ""
|
||||
var voiceData: VoiceCmdData? = null
|
||||
when (intent?.getStringExtra("command") ?: "") {
|
||||
VOICE_COMMAND_QUERY_TRAFFIC_CHECK -> {
|
||||
// 搜索交通检查
|
||||
voiceData = Utils.parseTOVoiceCmdData(data)
|
||||
voiceData.obj = TYPE_NAME_TRAFFIC_CHECK
|
||||
}
|
||||
VOICE_COMMAND_QUERY_ROAD_CLOSED -> {
|
||||
// 搜索封路
|
||||
Logger.d(TAG, "封路: $data")
|
||||
voiceData = Utils.parseTOVoiceCmdData(data)
|
||||
voiceData.location = voiceData.obj
|
||||
voiceData.obj = TYPE_NAME_CLOSURE
|
||||
}
|
||||
SPECIFIEDROAD_SEARCH->{
|
||||
// 拥堵和路况
|
||||
Logger.d(TAG,"拥堵和路况:$data")
|
||||
voiceData = Utils.parseTOVoiceCmdData(data)
|
||||
voiceData.obj = TYPE_NAME_BLOCK
|
||||
}
|
||||
// 其他道路事件
|
||||
VOICE_COMMAND_NOVELTY_QUERY -> voiceData = Utils.parseTOVoiceCmdData(data)
|
||||
else->{
|
||||
Logger.d(TAG, "未收录广播===${intent?.getStringExtra("command")}")
|
||||
}
|
||||
}
|
||||
|
||||
voiceData?.let {
|
||||
Logger.d(TAG, "准备开始网络请求,搜索附近道路事件: $it")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package com.mogo.module.tanlu.receiver;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.module.tanlu.model.event.SharedialogEvent;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description
|
||||
* @since 2020-02-09
|
||||
*/
|
||||
public class ShareDialogReceiver extends BroadcastReceiver {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if (intent.getAction() == "com.zhidao.sharedialog") {
|
||||
EventBus.getDefault().post(new SharedialogEvent());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
package com.mogo.module.tanlu.util;
|
||||
|
||||
import android.app.ActivityManager;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static android.content.Context.ACTIVITY_SERVICE;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description
|
||||
* @since 2019-09-26
|
||||
*/
|
||||
public class ActivityStatusUtil {
|
||||
/**
|
||||
* 判断某个activity是否在前台显示
|
||||
*/
|
||||
public static boolean isForeground(Context activity) {
|
||||
return isForeground(activity, "com.zhidao.roadcondition.main_module.MainActivity");
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断某个界面是否在前台,返回true,为显示,否则不是
|
||||
*/
|
||||
public static boolean isForeground(Context context, String className) {
|
||||
if (context == null || TextUtils.isEmpty(className)) {
|
||||
return false;
|
||||
}
|
||||
ActivityManager am = (ActivityManager) context.getSystemService(ACTIVITY_SERVICE);
|
||||
List<ActivityManager.RunningTaskInfo> list = am.getRunningTasks(1);
|
||||
if (list != null && list.size() > 0) {
|
||||
ComponentName cpn = list.get(0).topActivity;
|
||||
if (className.equals(cpn.getClassName())) {
|
||||
return true;
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,97 +0,0 @@
|
||||
package com.mogo.module.tanlu.util;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.module.common.entity.MarkerLocation;
|
||||
import com.mogo.module.common.entity.MarkerUserInfo;
|
||||
import com.mogo.module.tanlu.constant.TanluConstants;
|
||||
import com.mogo.module.tanlu.fragment.TanluServiceManager;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidao.carchattingprovider.CallChattingProviderConstant;
|
||||
import com.zhidao.carchattingprovider.ICallChatResponse;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 调用车聊聊的工具类
|
||||
*/
|
||||
public class ChartUtil {
|
||||
private static final String TAG = "ChartUtil";
|
||||
|
||||
public interface ChartStatusListener {
|
||||
void canCall(boolean b);
|
||||
}
|
||||
|
||||
/**
|
||||
* 调用车聊聊拨打电话
|
||||
*
|
||||
* @param userInfo 用户数据
|
||||
* @param location 位置信息
|
||||
*/
|
||||
public static void callChatting(MarkerUserInfo userInfo, MarkerLocation location) {
|
||||
try {
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put(CallChattingProviderConstant.CCPROVIDER_SN, userInfo.getSn());
|
||||
params.put(CallChattingProviderConstant.CCPROVIDER_USER_IMG, userInfo.getUserHead());
|
||||
params.put(CallChattingProviderConstant.CCPROVIDER_USER_AGE, userInfo.getAgeNumber() + "");
|
||||
params.put(CallChattingProviderConstant.CCPROVIDER_NICK_NAME, userInfo.getUserName());
|
||||
params.put(CallChattingProviderConstant.CCPROVIDER_USER_SEX, userInfo.getGender() + "");
|
||||
|
||||
if (location != null) {
|
||||
params.put(CallChattingProviderConstant.CCPROVIDER_ADDRESS, location.getAddress());
|
||||
params.put(CallChattingProviderConstant.CCPROVIDER_LAT, location.getLat() + "");
|
||||
params.put(CallChattingProviderConstant.CCPROVIDER_LON, location.getLon() + "");
|
||||
}
|
||||
|
||||
Logger.d(TAG, "调用车聊聊传入参数:\n" + params);
|
||||
TanluServiceManager.getCarsChattingProvider().call(params);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否可以拨打电话
|
||||
*
|
||||
* @param chartStatusListener 车聊聊状态监听
|
||||
*/
|
||||
public static void isOnLine(String sn, Context context, ChartStatusListener chartStatusListener) {
|
||||
TanluServiceManager.getCarsChattingProvider().isOnLine(
|
||||
"CAR_CALL_TO_" + TanluConstants.MODEL_NAME,
|
||||
context,
|
||||
sn,
|
||||
new ICallChatResponse() {
|
||||
@Override
|
||||
public void isOnLine(boolean onLine, @Nullable String errorMsg) {
|
||||
Logger.e(TAG, "isOnLine:" + onLine + " errorMsg:" + errorMsg);
|
||||
if (chartStatusListener != null) {
|
||||
chartStatusListener.canCall(onLine);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否可以拨打电话
|
||||
*
|
||||
* @param chartStatusListener 车聊聊状态监听
|
||||
*/
|
||||
public static void isCanCall(Context context, ChartStatusListener chartStatusListener) {
|
||||
TanluServiceManager.getCarsChattingProvider().canCall(
|
||||
"CAR_CALL_TO_" + TanluConstants.MODEL_NAME,
|
||||
context,
|
||||
new ICallChatResponse() {
|
||||
@Override
|
||||
public void canCall(boolean onLine) {
|
||||
Logger.e(TAG, "isOnLine:" + onLine);
|
||||
if (chartStatusListener != null) {
|
||||
chartStatusListener.canCall(onLine);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
package com.mogo.module.tanlu.util
|
||||
|
||||
|
||||
const val SPACE_TIME = 1000
|
||||
var lastClickTime = 0L
|
||||
var viewId: Int = 0
|
||||
|
||||
fun isDoubleClick(view: Int): Boolean {
|
||||
val time = System.currentTimeMillis()
|
||||
val timeD = time - lastClickTime
|
||||
if (timeD < SPACE_TIME && viewId == view) {
|
||||
return true
|
||||
}
|
||||
lastClickTime = time
|
||||
viewId = view
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
fun isDoubleClickTime(view: Int,spaceTime:Int): Boolean {
|
||||
val time = System.currentTimeMillis()
|
||||
val timeD = time - lastClickTime
|
||||
if (timeD < spaceTime && viewId == view) {
|
||||
return true
|
||||
}
|
||||
lastClickTime = time
|
||||
viewId = view
|
||||
return false
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
package com.mogo.module.tanlu.util;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapShader;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.RectF;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
|
||||
import com.bumptech.glide.load.resource.bitmap.BitmapTransformation;
|
||||
|
||||
import java.security.MessageDigest;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description
|
||||
* @since 2020/6/3
|
||||
*/
|
||||
public class GlideRoundTransform extends BitmapTransformation {
|
||||
private static float radius = 0f;
|
||||
|
||||
/**
|
||||
* 构造函数 默认圆角半径 4dp
|
||||
*
|
||||
* @param context Context
|
||||
*/
|
||||
public GlideRoundTransform(Context context) {
|
||||
this(context, 4);
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造函数
|
||||
*
|
||||
* @param context Context
|
||||
* @param dp 圆角半径
|
||||
*/
|
||||
public GlideRoundTransform(Context context, int dp) {
|
||||
// super(context);
|
||||
radius = Resources.getSystem().getDisplayMetrics().density * dp;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Bitmap transform(BitmapPool pool, Bitmap toTransform, int outWidth, int outHeight) {
|
||||
return roundCrop(pool, toTransform);
|
||||
}
|
||||
|
||||
private static Bitmap roundCrop(BitmapPool pool, Bitmap source) {
|
||||
if (source == null) return null;
|
||||
|
||||
Bitmap result = pool.get(source.getWidth(), source.getHeight(), Bitmap.Config.ARGB_8888);
|
||||
if (result == null) {
|
||||
result = Bitmap.createBitmap(source.getWidth(), source.getHeight(), Bitmap.Config.ARGB_8888);
|
||||
}
|
||||
|
||||
Canvas canvas = new Canvas(result);
|
||||
Paint paint = new Paint();
|
||||
paint.setShader(new BitmapShader(source, BitmapShader.TileMode.CLAMP, BitmapShader.TileMode.CLAMP));
|
||||
paint.setAntiAlias(true);
|
||||
RectF rectF = new RectF(0f, 0f, source.getWidth(), source.getHeight());
|
||||
canvas.drawRoundRect(rectF, radius, radius, paint);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
package com.mogo.module.tanlu.util
|
||||
|
||||
import android.os.Message
|
||||
import android.view.View
|
||||
import androidx.constraintlayout.widget.Group
|
||||
|
||||
class HideControl {
|
||||
|
||||
companion object {
|
||||
const val MSG_HIDE = 0x01
|
||||
}
|
||||
|
||||
private var mHideHandler: HideHandler = HideHandler()
|
||||
var view1: Group? = null
|
||||
var view2: Group? = null
|
||||
|
||||
val hideRunable = Runnable {
|
||||
mHideHandler.obtainMessage(MSG_HIDE).sendToTarget()
|
||||
}
|
||||
|
||||
private inner class HideHandler : android.os.Handler() {
|
||||
override fun handleMessage(msg: Message) {
|
||||
super.handleMessage(msg)
|
||||
when (msg.what) {
|
||||
MSG_HIDE -> {
|
||||
view1?.let {
|
||||
it.visibility = View.GONE
|
||||
}
|
||||
view2?.let {
|
||||
it.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun startHideTimer(view1: Group,view2: Group? = null) {
|
||||
this.view1 = view1
|
||||
this.view2 = view2
|
||||
mHideHandler.removeCallbacks(hideRunable)
|
||||
if (view1.visibility == View.GONE) {
|
||||
view1.visibility = View.VISIBLE
|
||||
}
|
||||
if (view2?.visibility == View.GONE) {
|
||||
view2.visibility = View.VISIBLE
|
||||
}
|
||||
mHideHandler.postDelayed(hideRunable, 3000)
|
||||
}
|
||||
|
||||
fun resetHideTimer() {
|
||||
if(view1 != null){
|
||||
view1!!.visibility = View.VISIBLE
|
||||
}
|
||||
if(view2 != null){
|
||||
view2!!.visibility = View.VISIBLE
|
||||
}
|
||||
mHideHandler.removeCallbacks(hideRunable)
|
||||
mHideHandler.postDelayed(hideRunable, 3000)
|
||||
}
|
||||
|
||||
fun endHideTime() {
|
||||
mHideHandler.removeCallbacks(hideRunable)
|
||||
if (view1 != null) {
|
||||
view1 = null
|
||||
}
|
||||
if (view2 != null) {
|
||||
view2 = null
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
package com.mogo.module.tanlu.util;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description
|
||||
* @since 2020/3/18
|
||||
*/
|
||||
public class LocationUtils {
|
||||
/**
|
||||
* 地球半径
|
||||
*/
|
||||
private static double EARTH_RADIUS = 6378.137;
|
||||
|
||||
private static double rad(double d) {
|
||||
return d * Math.PI / 180.0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过经纬度获取距离(单位:米)
|
||||
* @param lat1
|
||||
* @param lng1
|
||||
* @param lat2
|
||||
* @param lng2
|
||||
* @return
|
||||
*/
|
||||
public static double getDistance(double lat1, double lng1, double lat2,
|
||||
double lng2) {
|
||||
double radLat1 = rad(lat1);
|
||||
double radLat2 = rad(lat2);
|
||||
double a = radLat1 - radLat2;
|
||||
double b = rad(lng1) - rad(lng2);
|
||||
double s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2)
|
||||
+ Math.cos(radLat1) * Math.cos(radLat2)
|
||||
* Math.pow(Math.sin(b / 2), 2)));
|
||||
s = s * EARTH_RADIUS;
|
||||
s = Math.round(s * 10000d) / 10000d;
|
||||
s = s * 1000;
|
||||
return s;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,128 +0,0 @@
|
||||
package com.mogo.module.tanlu.util;
|
||||
|
||||
import android.Manifest;
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.Network;
|
||||
import android.net.NetworkInfo;
|
||||
import android.os.Build;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.RequiresPermission;
|
||||
|
||||
|
||||
public class NetworkUtil {
|
||||
/**
|
||||
* Returns true if device is connected to wifi or mobile network, false
|
||||
* otherwise.
|
||||
*
|
||||
* @param context
|
||||
* @return
|
||||
*/
|
||||
public static boolean isConnected(Context context) {
|
||||
ConnectivityManager conMan = (ConnectivityManager) context
|
||||
.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
if (conMan != null){
|
||||
NetworkInfo infoWifi = conMan.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
|
||||
|
||||
if (infoWifi != null) {
|
||||
NetworkInfo.State wifi = infoWifi.getState();
|
||||
if (wifi == NetworkInfo.State.CONNECTED) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
NetworkInfo infoMobile = conMan.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
|
||||
if (infoMobile != null) {
|
||||
NetworkInfo.State mobile = infoMobile.getState();
|
||||
if (mobile == NetworkInfo.State.CONNECTED) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if there is any connectivity to a Wifi network
|
||||
*
|
||||
* @param context
|
||||
* @return
|
||||
*/
|
||||
public static boolean isConnectedWifi(Context context) {
|
||||
NetworkInfo info = getNetworkInfo(context);
|
||||
return (info != null && info.isConnected() && info.getType() == ConnectivityManager.TYPE_WIFI);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if there is any connectivity to a mobile network
|
||||
*
|
||||
* @param context
|
||||
* @return
|
||||
*/
|
||||
public static boolean isConnectedMobile(Context context) {
|
||||
NetworkInfo info = getNetworkInfo(context);
|
||||
return (info != null && info.isConnected() && info.getType() == ConnectivityManager.TYPE_MOBILE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the network info
|
||||
*
|
||||
* @param context
|
||||
* @return
|
||||
*/
|
||||
@Nullable
|
||||
public static NetworkInfo getNetworkInfo(Context context) {
|
||||
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
if (cm != null){
|
||||
return cm.getActiveNetworkInfo();
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@TargetApi( Build.VERSION_CODES.LOLLIPOP )
|
||||
@RequiresPermission(allOf = {Manifest.permission.ACCESS_NETWORK_STATE})
|
||||
public static boolean isConnectedV21(Context context){
|
||||
|
||||
boolean isConnect = false;
|
||||
ConnectivityManager connMgr = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
|
||||
Network[] networks = connMgr.getAllNetworks();
|
||||
if (networks.length == 0) {
|
||||
isConnect = false;
|
||||
} else if (networks.length == 1) {
|
||||
NetworkInfo networkInfo = connMgr.getNetworkInfo(networks[0]);
|
||||
if (networkInfo != null) {
|
||||
if (networkInfo.isConnected()) {
|
||||
isConnect = true;
|
||||
} else {
|
||||
isConnect = false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else if (networks.length == 2) {
|
||||
//两个同时存在
|
||||
NetworkInfo networkInfoOne = connMgr.getNetworkInfo(networks[0]);
|
||||
NetworkInfo networkInfoTwo = connMgr.getNetworkInfo(networks[1]);
|
||||
if (networkInfoOne == null || networkInfoTwo == null) {
|
||||
return false;
|
||||
}
|
||||
if (networkInfoOne.isConnected() && networkInfoTwo.isConnected()) {
|
||||
isConnect = true;
|
||||
} else if (networkInfoOne.isConnected() && !networkInfoTwo.isConnected()) {
|
||||
isConnect = true;
|
||||
} else if (!networkInfoOne.isConnected() && networkInfoTwo.isConnected()) {
|
||||
isConnect = true;
|
||||
} else {
|
||||
isConnect = false;
|
||||
}
|
||||
}
|
||||
return isConnect;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
package com.mogo.module.tanlu.util
|
||||
|
||||
import android.text.format.DateFormat
|
||||
import com.google.gson.Gson
|
||||
import java.text.DecimalFormat
|
||||
|
||||
const val format = "yyyy/MM/dd HH:mm"
|
||||
|
||||
fun formatDate(time: Long): String {
|
||||
return DateFormat.format(format, time).toString()
|
||||
}
|
||||
|
||||
fun convertVar(param: Any?): Any? {
|
||||
return if (param is String) {
|
||||
"\"$param\""
|
||||
} else {
|
||||
param
|
||||
}
|
||||
}
|
||||
|
||||
//处理距离,大于1000时,四舍五入保留一位小数
|
||||
fun handleDistances(distance: Int): String {
|
||||
if (distance < 1000) {
|
||||
return distance.toString() + "M"
|
||||
} else {
|
||||
var floatDistance = distance.toFloat()
|
||||
val df = DecimalFormat("0.0")
|
||||
val transformDistance = floatDistance / 1000
|
||||
return (df.format(transformDistance)).toString() + "KM"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
package com.mogo.module.tanlu.util;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.mogo.module.tanlu.model.VoiceCmdData;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description
|
||||
* @since 2020-01-08
|
||||
*/
|
||||
public class Utils {
|
||||
|
||||
//处理距离,大于1000时,四舍五入保留一位小数
|
||||
public static String handleDistance(double distance) {
|
||||
if (distance < 1000) {
|
||||
return distance + "M";
|
||||
} else {
|
||||
DecimalFormat df = new DecimalFormat("0.0");
|
||||
double transformDistance = distance / 1000;
|
||||
return (df.format(transformDistance)) + "KM";
|
||||
}
|
||||
}
|
||||
|
||||
//保留整数,四舍五入
|
||||
public static int getIntervalValue(int listSize){
|
||||
// var floatSize = listSize.toFloat();
|
||||
int transformSize = listSize / 15;
|
||||
DecimalFormat df = new DecimalFormat("0");
|
||||
return Integer.parseInt((df.format(transformSize)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析json串为 VoiceCmdData 对象
|
||||
*
|
||||
* @param dataJsonStr
|
||||
* @return
|
||||
*/
|
||||
public static VoiceCmdData parseTOVoiceCmdData(String dataJsonStr) {
|
||||
Gson gson = new Gson();
|
||||
return gson.fromJson(dataJsonStr, VoiceCmdData.class);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,146 +0,0 @@
|
||||
//package com.mogo.module.tanlu.video
|
||||
//
|
||||
//import android.app.Activity
|
||||
//import android.content.Intent
|
||||
//import android.os.Bundle
|
||||
//import android.util.Log
|
||||
//import android.view.View
|
||||
//import androidx.appcompat.app.AppCompatActivity
|
||||
//import com.mogo.module.tanlu.R
|
||||
//import com.mogo.module.tanlu.util.HideControl
|
||||
//import com.mogo.module.tanlu.util.formatDate
|
||||
//import com.mogo.utils.logger.Logger
|
||||
//import com.shuyu.gsyvideoplayer.GSYVideoManager
|
||||
//import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder
|
||||
//import kotlinx.android.synthetic.main.tanlu_activity_media_full.*
|
||||
//import java.util.*
|
||||
//
|
||||
///**
|
||||
// * 全屏显示适配
|
||||
// */
|
||||
//
|
||||
//class FullMediaActivity : AppCompatActivity(), View.OnClickListener {
|
||||
// companion object {
|
||||
// const val TAG = "FullMediaActivity"
|
||||
//
|
||||
// const val PARAM_VIDEO_URL = "param_video_url"
|
||||
// const val PARAM_THUMB_URL = "param_thumb_url"
|
||||
// const val PARAM_ADDRESS = "param_address"
|
||||
// const val PARAM_TIME = "generate_time"
|
||||
//
|
||||
//
|
||||
//// fun launch(context: Activity, strategyInfo: List<Informations>, position: Int) {
|
||||
//// val intent = Intent(context, FullMediaActivity::class.java)
|
||||
//// intent.putExtra(PARAM_MEDIA_POSITION, position)
|
||||
//// // 使用全局静态对象代替,避免序列化开销
|
||||
//// GlobalSharedInformation.informationList = strategyInfo as ArrayList<Informations>
|
||||
//// context.startActivityForResult(intent, REQUESTCODE_MAINACTIVITY)
|
||||
//// context.overridePendingTransition(0, 0)
|
||||
//// }
|
||||
//
|
||||
// fun launch(context: Activity, videoUrl: String, thumbnail: String, address: String, generateTime: Long) {
|
||||
// val intent = Intent(context, FullMediaActivity::class.java)
|
||||
// intent.putExtra(PARAM_VIDEO_URL, videoUrl)
|
||||
// intent.putExtra(PARAM_THUMB_URL, thumbnail)
|
||||
// intent.putExtra(PARAM_ADDRESS, address)
|
||||
// intent.putExtra(PARAM_TIME, generateTime)
|
||||
// context.startActivity(intent)
|
||||
// context.overridePendingTransition(0, 0)
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private var control = HideControl()
|
||||
// private var gsyVideoOptionBuilder = GSYVideoOptionBuilder()
|
||||
// private var videoUrl: String? = null
|
||||
// private var thumbUrl: String? = null
|
||||
// private var address: String? = null
|
||||
// private var generateTime: Long = 0
|
||||
//
|
||||
//
|
||||
//
|
||||
// override fun onCreate(savedInstanceState: Bundle?) {
|
||||
// super.onCreate(savedInstanceState)
|
||||
// setContentView(R.layout.tanlu_activity_media_full)
|
||||
// handleIntent()
|
||||
// setListener()
|
||||
// }
|
||||
//
|
||||
// private fun handleIntent() {
|
||||
// var intent = intent
|
||||
//
|
||||
// videoUrl = intent.getStringExtra(PARAM_VIDEO_URL)
|
||||
// thumbUrl = intent.getStringExtra(PARAM_THUMB_URL)
|
||||
// address = intent.getStringExtra(PARAM_ADDRESS)
|
||||
// generateTime = intent.getLongExtra(PARAM_TIME, 0)
|
||||
// }
|
||||
//
|
||||
// override fun onResume() {
|
||||
// super.onResume()
|
||||
// updateInformation()
|
||||
// GSYVideoManager.onResume()
|
||||
// }
|
||||
//
|
||||
// override fun onPause() {
|
||||
// super.onPause()
|
||||
// GSYVideoManager.onPause()
|
||||
// }
|
||||
//
|
||||
// //需要监听完成事件
|
||||
// private fun setListener() {
|
||||
// iv_media_back.setOnClickListener(this)
|
||||
// //重置timer
|
||||
// video_view.addSingleClickListener(object :
|
||||
// MediaCoverVideoPlayer.SingleClickListener {
|
||||
// override fun onClick() {
|
||||
// control.resetHideTimer()
|
||||
// }
|
||||
// })
|
||||
//
|
||||
// //视频播放完成
|
||||
// video_view.onCompletionListener(object :
|
||||
// MediaCoverVideoPlayer.CompletionListener {
|
||||
// override fun onCompletion() {
|
||||
// finish()
|
||||
// }
|
||||
// })
|
||||
//
|
||||
// video_view
|
||||
// video_view.loadCoverImage(thumbUrl!!)
|
||||
// //设置url,点击播放
|
||||
// gsyVideoOptionBuilder.setUrl(videoUrl).setCacheWithPlay(true)
|
||||
// .setPlayTag(TAG).build(video_view)
|
||||
// video_view.startButton.performClick()
|
||||
// }
|
||||
//
|
||||
//
|
||||
// private fun updateInformation() {
|
||||
// tv_media_title_content.text = address
|
||||
// tv_media_title_time.text = formatDate(generateTime)
|
||||
// }
|
||||
//
|
||||
//
|
||||
// override fun onClick(view: View) {
|
||||
// view?.let {
|
||||
// when (view) {
|
||||
// iv_media_back -> {
|
||||
// handleBack()
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// override fun onDestroy() {
|
||||
// super.onDestroy()
|
||||
// GSYVideoManager.releaseAllVideos()
|
||||
// overridePendingTransition(0, 0)
|
||||
// }
|
||||
//
|
||||
// private fun handleBack() {
|
||||
// finish()
|
||||
// }
|
||||
//
|
||||
// override fun onBackPressed() {
|
||||
// super.onBackPressed()
|
||||
// handleBack()
|
||||
// }
|
||||
//}
|
||||
@@ -1,162 +0,0 @@
|
||||
package com.mogo.module.tanlu.video
|
||||
|
||||
//package com.mogo.module.tanlu.video
|
||||
//
|
||||
//import android.content.Context
|
||||
//import android.util.AttributeSet
|
||||
//import android.util.Log
|
||||
//import android.view.View
|
||||
//import android.widget.ImageView
|
||||
//import android.widget.SeekBar
|
||||
//import com.bumptech.glide.Glide
|
||||
//import com.mogo.module.tanlu.R
|
||||
//import com.shuyu.gsyvideoplayer.GSYVideoManager
|
||||
//import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer
|
||||
//import com.shuyu.gsyvideoplayer.video.base.GSYVideoView
|
||||
//import com.shuyu.gsyvideoplayer.video.base.GSYVideoViewBridge
|
||||
//
|
||||
//
|
||||
///**
|
||||
// * 全屏播放
|
||||
// */
|
||||
//class MediaCoverVideoPlayer : StandardGSYVideoPlayer {
|
||||
//
|
||||
// private lateinit var coverImage: ImageView
|
||||
// private lateinit var start: ImageView
|
||||
// private lateinit var fullscreen: ImageView
|
||||
// private lateinit var singleClickListener: SingleClickListener
|
||||
// private lateinit var completionListener: CompletionListener
|
||||
//
|
||||
// constructor(context: Context?) : super(context)
|
||||
// constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs)
|
||||
// constructor(context: Context?, fullFlag: Boolean?) : super(context, fullFlag)
|
||||
//
|
||||
// interface SingleClickListener {
|
||||
// fun onClick()
|
||||
// }
|
||||
//
|
||||
// interface CompletionListener {
|
||||
// fun onCompletion()
|
||||
// }
|
||||
//
|
||||
// override fun init(context: Context) {
|
||||
// super.init(context)
|
||||
// coverImage = findViewById(R.id.thumbImage)
|
||||
// start = findViewById(R.id.start)
|
||||
// fullscreen = findViewById(R.id.fullscreen)
|
||||
// if (mThumbImageViewLayout != null
|
||||
// && (mCurrentState == -1 || mCurrentState == GSYVideoView.CURRENT_STATE_NORMAL || mCurrentState == GSYVideoView.CURRENT_STATE_ERROR)
|
||||
// ) {
|
||||
// mThumbImageViewLayout.visibility = View.VISIBLE
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// fun addSingleClickListener(singleClickListener: SingleClickListener) {
|
||||
// this.singleClickListener = singleClickListener
|
||||
// }
|
||||
//
|
||||
// fun onCompletionListener(completionListener: CompletionListener) {
|
||||
// this.completionListener = completionListener
|
||||
// }
|
||||
//
|
||||
// override fun getLayoutId(): Int {
|
||||
// return R.layout.tanlu_item_video_cover_media
|
||||
// }
|
||||
//
|
||||
// override fun getGSYVideoManager(): GSYVideoViewBridge {
|
||||
// GSYVideoManager.instance().initContext(context.applicationContext)
|
||||
// return GSYVideoManager.instance()
|
||||
// }
|
||||
//
|
||||
// override fun setProgressAndTime(progress: Int, secProgress: Int, currentTime: Int, totalTime: Int, forceChange: Boolean) {
|
||||
// super.setProgressAndTime(progress, secProgress, currentTime, totalTime, forceChange)
|
||||
// if (progress != 0) {
|
||||
// mProgressBar.progress = progress
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// fun loadCoverImage(url: String) {
|
||||
// Glide.with(context)
|
||||
// .load(url)
|
||||
// .into(coverImage)
|
||||
// }
|
||||
//
|
||||
// override fun updateStartImage() {
|
||||
// when (mCurrentState) {
|
||||
// GSYVideoView.CURRENT_STATE_PLAYING -> start.setImageResource(R.drawable.selector_bg_btn_pause)
|
||||
// GSYVideoView.CURRENT_STATE_ERROR -> start.setImageResource(R.drawable.main_video_refresh_btn)
|
||||
// else -> start.setImageResource(R.drawable.selector_bg_btn_play)
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// fun setFullClickListener(listener: OnClickListener) {
|
||||
// fullscreen.setOnClickListener(listener)
|
||||
// }
|
||||
//
|
||||
// override fun onClickUiToggle() {
|
||||
// super.onClickUiToggle()
|
||||
// singleClickListener.let {
|
||||
// it.onClick()
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// override fun changeUiToCompleteShow() {
|
||||
// super.changeUiToCompleteShow()
|
||||
//// setViewShowState(mBottomContainer, View.INVISIBLE)
|
||||
// }
|
||||
//
|
||||
// override fun onAutoCompletion() {
|
||||
// super.onAutoCompletion()
|
||||
// mProgressBar.progress = 0
|
||||
//
|
||||
// completionListener.let {
|
||||
// it.onCompletion()
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// override fun showWifiDialog() {
|
||||
// //直接播放,不显示WIFI对话框
|
||||
// startPlayLogic()
|
||||
// }
|
||||
//
|
||||
// override fun onClick(v: View?) {
|
||||
// super.onClick(v)
|
||||
// v?.let {
|
||||
// when (v) {
|
||||
// start -> {
|
||||
//
|
||||
// }
|
||||
// else -> {
|
||||
//
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// override fun onPrepared() {
|
||||
// super.onPrepared()
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 多次回调
|
||||
// */
|
||||
// override fun onCompletion() {
|
||||
// super.onCompletion()
|
||||
// }
|
||||
//
|
||||
//
|
||||
// override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) {
|
||||
// super.onProgressChanged(seekBar, progress, fromUser)
|
||||
// }
|
||||
//
|
||||
// override fun onDetachedFromWindow() {
|
||||
// super.onDetachedFromWindow()
|
||||
// mFullPauseBitmap?.let {
|
||||
// if (!it.isRecycled) {
|
||||
// it.recycle()
|
||||
// }
|
||||
// }
|
||||
// mFullPauseBitmap = null
|
||||
// }
|
||||
//
|
||||
//}
|
||||
@@ -1,194 +0,0 @@
|
||||
//package com.mogo.module.tanlu.video
|
||||
//
|
||||
//import android.content.Context
|
||||
//import android.util.AttributeSet
|
||||
//import android.util.Log
|
||||
//import android.view.Surface
|
||||
//import android.view.View
|
||||
//import android.widget.ImageView
|
||||
//import com.bumptech.glide.Glide
|
||||
//import com.bumptech.glide.request.RequestOptions
|
||||
//import com.mogo.module.common.glide.SkinAbleBitmapTarget
|
||||
//import com.mogo.module.tanlu.R
|
||||
//import com.mogo.utils.logger.Logger
|
||||
//import com.shuyu.gsyvideoplayer.GSYVideoManager
|
||||
//import com.shuyu.gsyvideoplayer.utils.GSYVideoType
|
||||
//import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer
|
||||
//import com.shuyu.gsyvideoplayer.video.base.GSYVideoView
|
||||
//import com.shuyu.gsyvideoplayer.video.base.GSYVideoViewBridge
|
||||
//
|
||||
//
|
||||
//class SimpleCoverVideoPlayer : StandardGSYVideoPlayer {
|
||||
// private lateinit var coverImage: ImageView
|
||||
// private lateinit var start: ImageView
|
||||
// private lateinit var fullscreen: ImageView
|
||||
//
|
||||
// companion object {
|
||||
// @JvmField
|
||||
// val TAG: String = "SimpleCoverVideoPlayer.kt"
|
||||
// }
|
||||
//
|
||||
// constructor(context: Context?) : super(context)
|
||||
// constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs)
|
||||
// constructor(context: Context?, fullFlag: Boolean?) : super(context, fullFlag)
|
||||
//
|
||||
// override fun init(context: Context) {
|
||||
// super.init(context)
|
||||
// coverImage = findViewById(R.id.thumbImage)
|
||||
// start = findViewById(R.id.start)
|
||||
// fullscreen = findViewById(R.id.fullscreen)
|
||||
// if (mThumbImageViewLayout != null
|
||||
// && (mCurrentState == -1 || mCurrentState == GSYVideoView.CURRENT_STATE_NORMAL || mCurrentState == GSYVideoView.CURRENT_STATE_ERROR)
|
||||
// ) {
|
||||
// mThumbImageViewLayout.visibility = View.VISIBLE
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// override fun getLayoutId(): Int {
|
||||
// return R.layout.tanlu_item_video_cover
|
||||
// }
|
||||
//
|
||||
// override fun getGSYVideoManager(): GSYVideoViewBridge {
|
||||
// GSYVideoManager.instance().initContext(context.applicationContext)
|
||||
// return GSYVideoManager.instance()
|
||||
// }
|
||||
//
|
||||
// override fun setProgressAndTime(progress: Int, secProgress: Int, currentTime: Int, totalTime: Int, forceChange: Boolean) {
|
||||
// super.setProgressAndTime(progress, secProgress, currentTime, totalTime, forceChange)
|
||||
// if (progress != 0) {
|
||||
//// Log.d("liyz", "SimpleCoverVideoPlayer setProgressAndTime -----2---- $progress");
|
||||
// mProgressBar.progress = progress
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// fun loadCoverImage(url: String, mContext: Context) {
|
||||
// //加载图片
|
||||
// val requestOptions = RequestOptions()
|
||||
//// .placeholder(R.drawable.tanlu_normal_image)
|
||||
// .error(R.drawable.tanlu_normal_image)
|
||||
// Glide.with(mContext).asBitmap()
|
||||
// .load(url)
|
||||
// .apply(requestOptions)
|
||||
// .into(SkinAbleBitmapTarget(coverImage, requestOptions))
|
||||
//
|
||||
// }
|
||||
//
|
||||
// override fun updateStartImage() {
|
||||
// when (mCurrentState) {
|
||||
//// GSYVideoView.CURRENT_STATE_PLAYING -> start.setImageResource(R.drawable.selector_bg_btn_pause)
|
||||
//// GSYVideoView.CURRENT_STATE_ERROR -> start.setImageResource(R.drawable.main_video_refresh_btn)
|
||||
//// else -> start.setImageResource(R.drawable.selector_bg_btn_play)
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// fun setFullClickListener(listener: OnClickListener) {
|
||||
// fullscreen.setOnClickListener(listener)
|
||||
// }
|
||||
//
|
||||
// override fun changeUiToCompleteShow() {
|
||||
// super.changeUiToCompleteShow()
|
||||
//// setViewShowState(mBottomContainer, View.INVISIBLE)
|
||||
// mBottomContainer.visibility = View.INVISIBLE
|
||||
// mProgressBar.visibility = View.GONE
|
||||
// }
|
||||
//
|
||||
// override fun hideAllWidget() {
|
||||
// super.hideAllWidget()
|
||||
// mBottomContainer.visibility = View.INVISIBLE
|
||||
// mProgressBar.visibility = View.GONE
|
||||
// }
|
||||
//
|
||||
// override fun changeUiToPrepareingClear() {
|
||||
// super.changeUiToPrepareingClear()
|
||||
// mBottomContainer.visibility = View.INVISIBLE
|
||||
// mProgressBar.visibility = View.GONE
|
||||
// }
|
||||
//
|
||||
// override fun changeUiToPlayingBufferingClear() {
|
||||
// super.changeUiToPlayingBufferingClear()
|
||||
// mBottomContainer.visibility = View.INVISIBLE
|
||||
// mProgressBar.visibility = View.GONE
|
||||
//
|
||||
// }
|
||||
//
|
||||
// override fun changeUiToClear() {
|
||||
// super.changeUiToClear()
|
||||
// mBottomContainer.visibility = View.INVISIBLE
|
||||
// mProgressBar.visibility = View.GONE
|
||||
// }
|
||||
//
|
||||
// override fun changeUiToCompleteClear() {
|
||||
// super.changeUiToCompleteClear()
|
||||
// mBottomContainer.visibility = View.INVISIBLE
|
||||
// mProgressBar.visibility = View.GONE
|
||||
// }
|
||||
//
|
||||
// override fun onAutoCompletion() {
|
||||
// super.onAutoCompletion()
|
||||
// mProgressBar.progress = 0
|
||||
// }
|
||||
//
|
||||
// override fun showWifiDialog() {
|
||||
// //直接播放,不显示WIFI对话框
|
||||
// startPlayLogic()
|
||||
// }
|
||||
//
|
||||
// override fun onDetachedFromWindow() {
|
||||
// super.onDetachedFromWindow()
|
||||
// mProgressBar.progress = 0
|
||||
// mFullPauseBitmap = null
|
||||
// if (mAudioManager != null) {
|
||||
// try {
|
||||
// mAudioManager.abandonAudioFocus(onAudioFocusChangeListener)
|
||||
// } catch (e: Exception) {
|
||||
// Logger.e(TAG, e, "onDetachedFromWindow - abandonAudioFocus")
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// override fun onClick(v: View?) {
|
||||
// super.onClick(v)
|
||||
// v?.let {
|
||||
// when (v) {
|
||||
// start -> {
|
||||
//
|
||||
// }
|
||||
// else -> {
|
||||
//
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// override fun onPrepared() {
|
||||
// super.onPrepared()
|
||||
// }
|
||||
//
|
||||
// override fun onCompletion() {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// override fun onSurfaceUpdated(surface: Surface) {
|
||||
// super.onSurfaceUpdated(surface)
|
||||
// if (mThumbImageViewLayout != null && mThumbImageViewLayout.visibility == View.VISIBLE) {
|
||||
// mThumbImageViewLayout.visibility = View.INVISIBLE
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// override fun setViewShowState(view: View?, visibility: Int) {
|
||||
// if (view === mThumbImageViewLayout && visibility != View.VISIBLE) {
|
||||
// return
|
||||
// }
|
||||
// super.setViewShowState(view, visibility)
|
||||
// }
|
||||
//
|
||||
// override fun onSurfaceAvailable(surface: Surface) {
|
||||
// super.onSurfaceAvailable(surface)
|
||||
// mProgressBar.visibility = View.GONE
|
||||
// if (GSYVideoType.getRenderType() != GSYVideoType.TEXTURE) {
|
||||
// if (mThumbImageViewLayout != null && mThumbImageViewLayout.visibility == View.VISIBLE) {
|
||||
// mThumbImageViewLayout.visibility = View.INVISIBLE
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
@@ -1,23 +0,0 @@
|
||||
//package com.mogo.module.tanlu.video
|
||||
//
|
||||
//import com.shuyu.gsyvideoplayer.GSYVideoManager
|
||||
//import com.shuyu.gsyvideoplayer.cache.CacheFactory
|
||||
//import com.shuyu.gsyvideoplayer.cache.ProxyCacheManager
|
||||
//import com.shuyu.gsyvideoplayer.model.VideoOptionModel
|
||||
//import com.shuyu.gsyvideoplayer.player.IjkPlayerManager
|
||||
//import com.shuyu.gsyvideoplayer.player.PlayerFactory
|
||||
//import com.shuyu.gsyvideoplayer.utils.GSYVideoType
|
||||
//import tv.danmaku.ijk.media.player.IjkMediaPlayer
|
||||
//
|
||||
//
|
||||
//fun initVideo() {
|
||||
// PlayerFactory.setPlayManager(IjkPlayerManager::class.java)
|
||||
// CacheFactory.setCacheManager(ProxyCacheManager::class.java)
|
||||
// var list = mutableListOf<VideoOptionModel>()
|
||||
// list.add(VideoOptionModel(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "enable-accurate-seek", 1))
|
||||
// list.add(VideoOptionModel(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "videotoolbox", 0))
|
||||
//// list.add(VideoOptionModel(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "dns_cache_clear", 1))
|
||||
// GSYVideoManager.instance().optionModelList = list
|
||||
// GSYVideoType.enableMediaCodec()
|
||||
// GSYVideoType.enableMediaCodecTexture()
|
||||
//}
|
||||
@@ -1,274 +0,0 @@
|
||||
package com.mogo.module.tanlu.view;
|
||||
|
||||
import com.mogo.service.imageloader.MogoImageView;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.content.Context;
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description
|
||||
* @since 2020-01-06
|
||||
*/
|
||||
public class AutoZoomInImageView extends MogoImageView {
|
||||
private int mDrawableW;
|
||||
private int mDrawableH;
|
||||
private int mImageViewW;
|
||||
private int mImageViewH;
|
||||
private long mDurationMillis = 700;
|
||||
|
||||
private float[] mValues = new float[9];
|
||||
private float mScaleDelta = 0.2f;
|
||||
|
||||
private Drawable mDrawable;
|
||||
private Matrix mMatrix;
|
||||
|
||||
public AutoZoomInImageView(Context context) {
|
||||
super(context);
|
||||
this.setScaleType(ScaleType.MATRIX);
|
||||
}
|
||||
|
||||
public AutoZoomInImageView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
this.setScaleType(ScaleType.MATRIX);
|
||||
}
|
||||
|
||||
public AutoZoomInImageView(Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
this.setScaleType(ScaleType.MATRIX);
|
||||
}
|
||||
|
||||
public AutoZoomInImageView init() {
|
||||
initInternalValues();
|
||||
initPicturePosition();
|
||||
return this;
|
||||
}
|
||||
|
||||
public void init(Drawable drawable) {
|
||||
initInternalValues(drawable);
|
||||
initPicturePosition();
|
||||
}
|
||||
|
||||
private void initInternalValues() {
|
||||
mDrawable = getDrawable();
|
||||
|
||||
if (mDrawable == null) {
|
||||
throw new IllegalArgumentException("please set the source of AutoZoomInImageView");
|
||||
}
|
||||
|
||||
mDrawableW = mDrawable.getIntrinsicWidth();
|
||||
mDrawableH = mDrawable.getIntrinsicHeight();
|
||||
|
||||
mImageViewW = getMeasuredWidth();
|
||||
mImageViewH = getMeasuredHeight();
|
||||
|
||||
mMatrix = getImageMatrix();
|
||||
mMatrix.getValues(mValues);
|
||||
}
|
||||
|
||||
private void initInternalValues(Drawable drawable) {
|
||||
mDrawable = drawable;
|
||||
|
||||
if (mDrawable == null) {
|
||||
throw new IllegalArgumentException("please set the source of AutoZoomInImageView");
|
||||
}
|
||||
|
||||
mDrawableW = mDrawable.getIntrinsicWidth();
|
||||
mDrawableH = mDrawable.getIntrinsicHeight();
|
||||
|
||||
mImageViewW = getMeasuredWidth();
|
||||
mImageViewH = getMeasuredHeight();
|
||||
|
||||
mMatrix = getImageMatrix();
|
||||
mMatrix.getValues(mValues);
|
||||
}
|
||||
|
||||
private void initPicturePosition() {
|
||||
updateMatrixValuesOrigin(mMatrix, mValues, mDrawableW, mDrawableH, mImageViewW, mImageViewH);
|
||||
setImageMatrix(mMatrix);
|
||||
}
|
||||
|
||||
private ValueAnimator mCurrentAnimator;
|
||||
|
||||
private void startZoomInByScaleDelta(final float scaleDelta, long duration) {
|
||||
|
||||
final float oriScaleX = mValues[0];
|
||||
final float oriScaleY = mValues[4];
|
||||
|
||||
mCurrentAnimator = ValueAnimator.ofFloat(0, scaleDelta);
|
||||
mCurrentAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
|
||||
|
||||
@Override
|
||||
public void onAnimationUpdate(ValueAnimator animation) {
|
||||
float value = (Float) animation.getAnimatedValue();
|
||||
if (mOnZoomListener != null)
|
||||
mOnZoomListener.onUpdate(AutoZoomInImageView.this, value / scaleDelta);
|
||||
updateMatrixValuesSpan(mValues, mDrawableW, mDrawableH, mImageViewW, mImageViewH,
|
||||
oriScaleX, oriScaleY, value);
|
||||
mMatrix.setValues(mValues);
|
||||
setImageMatrix(mMatrix);
|
||||
}
|
||||
});
|
||||
mCurrentAnimator.addListener(new Animator.AnimatorListener() {
|
||||
@Override
|
||||
public void onAnimationStart(Animator animation) {
|
||||
if (mOnZoomListener != null) mOnZoomListener.onStart(AutoZoomInImageView.this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
if (mOnZoomListener != null) mOnZoomListener.onEnd(AutoZoomInImageView.this);
|
||||
mCurrentAnimator = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationCancel(Animator animation) {
|
||||
mCurrentAnimator = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationRepeat(Animator animation) {
|
||||
}
|
||||
});
|
||||
mCurrentAnimator.setDuration(duration);
|
||||
mCurrentAnimator.start();
|
||||
}
|
||||
|
||||
/**
|
||||
* 停止动画
|
||||
*/
|
||||
public void stopCurrentAnimator(){
|
||||
if ( mCurrentAnimator != null ) {
|
||||
if ( mCurrentAnimator.isRunning() ) {
|
||||
mCurrentAnimator.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* start zooming in
|
||||
*
|
||||
* @param scaleDelta the scale that the image will add to original scale
|
||||
* @param durationMillis the duration of zoomin animation, in millisecond.
|
||||
* @param delayMillis the delayed time of starting zoomin animation, in millisecond.
|
||||
*/
|
||||
public void startZoomInByScaleDeltaAndDuration(final float scaleDelta, final long durationMillis, long delayMillis) {
|
||||
if (scaleDelta < 0) {
|
||||
throw new IllegalArgumentException("scaleDelta should be larger than 0, now scaleDelta is " + scaleDelta);
|
||||
}
|
||||
if (durationMillis < 0) {
|
||||
throw new IllegalArgumentException("durationMillis should not be less than 0, now durationMillis is " + durationMillis);
|
||||
}
|
||||
if (delayMillis < 0) {
|
||||
throw new IllegalArgumentException("delayMillis should not be less than 0, now delayMillis is " + delayMillis);
|
||||
}
|
||||
postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
startZoomInByScaleDelta(scaleDelta, durationMillis);
|
||||
}
|
||||
}, delayMillis);
|
||||
}
|
||||
|
||||
/**
|
||||
* the scale that the image will add to original scale
|
||||
*
|
||||
* @param scaleDelta
|
||||
* @return
|
||||
*/
|
||||
public AutoZoomInImageView setScaleDelta(float scaleDelta) {
|
||||
mScaleDelta = scaleDelta;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* the duration of zoomin animation, in millisecond.
|
||||
*
|
||||
* @param durationMillis
|
||||
* @return
|
||||
*/
|
||||
public AutoZoomInImageView setDurationMillis(long durationMillis) {
|
||||
mDurationMillis = durationMillis;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* callback when zoomin animation finished
|
||||
*
|
||||
* @param onZoomListener
|
||||
* @return
|
||||
*/
|
||||
public AutoZoomInImageView setOnZoomListener(OnZoomListener onZoomListener) {
|
||||
mOnZoomListener = onZoomListener;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* start animation of zoomin
|
||||
*
|
||||
* @param delayMillis the delayed time of starting zoomin animation, in millisecond.
|
||||
*/
|
||||
public void start(long delayMillis) {
|
||||
postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
startZoomInByScaleDelta(mScaleDelta, mDurationMillis);
|
||||
}
|
||||
}, delayMillis);
|
||||
}
|
||||
|
||||
private void updateMatrixValuesOrigin(Matrix outMatrix, float[] outValues, float drawW, float drawH, float imageW, float imageH) {
|
||||
if (outMatrix == null || outValues == null) {
|
||||
throw new IllegalArgumentException("please set the source of AutoZoomInImageView's matrix and values");
|
||||
}
|
||||
outMatrix.reset();
|
||||
if ((imageH * drawW > drawH * imageW)) {
|
||||
float scale1 = (imageH) / (drawH);
|
||||
float offset1 = (drawW * scale1 - imageW) / 2;
|
||||
outMatrix.postScale(scale1, scale1);
|
||||
outMatrix.postTranslate(-offset1, 0);
|
||||
} else {
|
||||
float scale2 = (imageW) / (drawW);
|
||||
float offset2 = (drawH * scale2 - imageH) / 2;
|
||||
outMatrix.postScale(scale2, scale2);
|
||||
outMatrix.postTranslate(0, -offset2);
|
||||
}
|
||||
outMatrix.getValues(outValues);
|
||||
}
|
||||
|
||||
private void updateMatrixValuesSpan(float[] outValues,
|
||||
float drawW, float drawH,
|
||||
float imageW, float imageH,
|
||||
float oriScaleX, float oriScaleY,
|
||||
float scaleDelta) {
|
||||
outValues[0] = oriScaleX * (1 + scaleDelta);
|
||||
outValues[4] = oriScaleY * (1 + scaleDelta);
|
||||
float offsetwidth = (drawW * outValues[0] - imageW) / 2;
|
||||
outValues[2] = -offsetwidth;
|
||||
float offsetHeight = (drawH * outValues[4] - imageH) / 2;
|
||||
outValues[5] = -offsetHeight;
|
||||
}
|
||||
|
||||
private OnZoomListener mOnZoomListener;
|
||||
|
||||
public interface OnZoomListener {
|
||||
/**
|
||||
* callback when zoom in animation is updating
|
||||
*
|
||||
* @param view AutoZoomInImageView
|
||||
* @param progress return the progress of animation, scope is [0,1]
|
||||
*/
|
||||
void onUpdate(View view, float progress);
|
||||
|
||||
void onEnd(View view);
|
||||
|
||||
void onStart(View view);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,169 +0,0 @@
|
||||
package com.mogo.module.tanlu.view;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.util.TypedValue;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.mogo.module.tanlu.R;
|
||||
|
||||
|
||||
public class NetErrorDialog extends Dialog {
|
||||
TextView txtOk;
|
||||
TextView txtCancel;
|
||||
TextView txtContent;
|
||||
TextView txtSubContent;
|
||||
|
||||
private int mContentSize = 0;
|
||||
private int mContentColor = 0;
|
||||
private int mBtnSize = 0;
|
||||
|
||||
private View.OnClickListener onOkListener, onCancelListener;
|
||||
|
||||
private String title, subContent, okText, cancelText;
|
||||
private CharSequence content;
|
||||
private boolean isAutoDismissDialog = true;
|
||||
|
||||
private int contentGravity = Gravity.CENTER;
|
||||
|
||||
private boolean isContentClickSpanEnable = false;
|
||||
|
||||
public NetErrorDialog(@NonNull Context context) {
|
||||
super(context, R.style.Theme_AppCompat_Dialog);
|
||||
getWindow().setBackgroundDrawableResource(android.R.color.transparent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.tanlu_dialog_neterror_layout);
|
||||
|
||||
initView();
|
||||
|
||||
if (mContentSize > 0){
|
||||
txtContent.setTextSize(TypedValue.COMPLEX_UNIT_PX,mContentSize);
|
||||
}
|
||||
|
||||
if (mContentColor > 0){
|
||||
txtContent.setTextColor(mContentColor);
|
||||
}
|
||||
|
||||
if ( content instanceof String ) {
|
||||
content = ( ( String ) content ).replace( "\\n", "\n" );
|
||||
}
|
||||
|
||||
txtContent.setText(content);
|
||||
if (TextUtils.isEmpty(subContent)) {
|
||||
txtSubContent.setVisibility(View.GONE);
|
||||
} else {
|
||||
txtSubContent.setVisibility(View.VISIBLE);
|
||||
txtSubContent.setText(subContent);
|
||||
}
|
||||
|
||||
if (mBtnSize > 0){
|
||||
txtOk.setTextSize(TypedValue.COMPLEX_UNIT_PX,mBtnSize);
|
||||
txtCancel.setTextSize(TypedValue.COMPLEX_UNIT_PX,mBtnSize);
|
||||
}
|
||||
|
||||
if (!TextUtils.isEmpty(okText)) {
|
||||
txtOk.setVisibility(View.VISIBLE);
|
||||
txtOk.setText(okText);
|
||||
} else {
|
||||
txtOk.setVisibility(View.GONE);
|
||||
}
|
||||
if (!TextUtils.isEmpty(cancelText)) {
|
||||
txtCancel.setVisibility(View.VISIBLE);
|
||||
txtCancel.setText(cancelText);
|
||||
} else {
|
||||
txtCancel.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
txtOk.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (isAutoDismissDialog) {
|
||||
dismiss();
|
||||
}
|
||||
if (onOkListener != null) {
|
||||
onOkListener.onClick(v);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
txtCancel.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (isAutoDismissDialog) {
|
||||
dismiss();
|
||||
}
|
||||
if (onCancelListener != null) {
|
||||
onCancelListener.onClick(v);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
txtContent.setGravity( contentGravity );
|
||||
|
||||
if ( isContentClickSpanEnable ) {
|
||||
txtContent.setMovementMethod( LinkMovementMethod.getInstance() );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
txtOk = findViewById(R.id.txt_ok);
|
||||
txtCancel = findViewById(R.id.txt_cancel);
|
||||
txtContent = findViewById(R.id.txt_content);
|
||||
txtSubContent = findViewById(R.id.txt_sub_content);
|
||||
}
|
||||
|
||||
public void setContent(CharSequence content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public void setSubContent(String subContent) {
|
||||
this.subContent = subContent;
|
||||
}
|
||||
|
||||
public TextView getTxtCancel() {
|
||||
return txtCancel;
|
||||
}
|
||||
|
||||
public void setOnOkClickListener(String okText, View.OnClickListener onOkClickListener) {
|
||||
this.okText = okText;
|
||||
this.onOkListener = onOkClickListener;
|
||||
}
|
||||
|
||||
public void setOnOkClickListener(View.OnClickListener onOkClickListener) {
|
||||
setOnOkClickListener("确定", onOkClickListener);
|
||||
}
|
||||
|
||||
public void setOnCancelListener(String cancelText, View.OnClickListener onCancelListener) {
|
||||
this.cancelText = cancelText;
|
||||
this.onCancelListener = onCancelListener;
|
||||
}
|
||||
|
||||
public void setOnCancelListener(View.OnClickListener onCancelListener) {
|
||||
setOnCancelListener("取消", onCancelListener);
|
||||
}
|
||||
|
||||
public void setAutoDismissDialog(boolean autoDismissDialog) {
|
||||
isAutoDismissDialog = autoDismissDialog;
|
||||
}
|
||||
|
||||
public int getContentGravity() {
|
||||
return contentGravity;
|
||||
}
|
||||
|
||||
public void setContentClickSpanEnable( boolean contentClickSpanEnable ) {
|
||||
isContentClickSpanEnable = contentClickSpanEnable;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,102 +0,0 @@
|
||||
package com.mogo.module.tanlu.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Path;
|
||||
import android.graphics.RectF;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import androidx.annotation.DrawableRes;
|
||||
|
||||
import com.mogo.module.tanlu.R;
|
||||
import com.mogo.skin.support.IMogoSkinCompatSupportable;
|
||||
import com.mogo.skin.support.helper.MogoSkinCompatBackgroundHelperDelegate;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020/3/25 11:39 AM
|
||||
* desc :
|
||||
* version: 1.0
|
||||
*/
|
||||
public class RoundLayout extends RelativeLayout implements IMogoSkinCompatSupportable {
|
||||
private float roundLayoutRadius = 14f;
|
||||
private Path roundPath;
|
||||
private RectF rectF;
|
||||
private MogoSkinCompatBackgroundHelperDelegate mBackgroundTintHelper;
|
||||
|
||||
public RoundLayout(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public RoundLayout(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public RoundLayout(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
|
||||
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.RoundLayout);
|
||||
roundLayoutRadius = typedArray.getDimensionPixelSize(R.styleable.RoundLayout_roundLayoutRadius, (int) roundLayoutRadius);
|
||||
typedArray.recycle();
|
||||
|
||||
init();
|
||||
|
||||
mBackgroundTintHelper = new MogoSkinCompatBackgroundHelperDelegate(this);
|
||||
mBackgroundTintHelper.loadFromAttributes(attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
|
||||
private void init() {
|
||||
setWillNotDraw(false);//如果你继承的是ViewGroup,注意此行,否则draw方法是不会回调的;
|
||||
roundPath = new Path();
|
||||
rectF = new RectF();
|
||||
}
|
||||
|
||||
private void setRoundPath() {
|
||||
//添加一个圆角矩形到path中, 如果要实现任意形状的View, 只需要手动添加path就行
|
||||
roundPath.addRoundRect(rectF, roundLayoutRadius, roundLayoutRadius, Path.Direction.CW);
|
||||
}
|
||||
|
||||
|
||||
public void setRoundLayoutRadius(float roundLayoutRadius) {
|
||||
this.roundLayoutRadius = roundLayoutRadius;
|
||||
setRoundPath();
|
||||
postInvalidate();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setBackgroundResource(@DrawableRes int resId) {
|
||||
super.setBackgroundResource(resId);
|
||||
if (mBackgroundTintHelper != null) {
|
||||
mBackgroundTintHelper.onSetBackgroundResource(resId);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onLayout(boolean changed, int l, int t, int r, int b) {
|
||||
super.onLayout(changed, l, t, r, b);
|
||||
rectF.set(0f, 0f, getMeasuredWidth(), getMeasuredHeight());
|
||||
setRoundPath();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Canvas canvas) {
|
||||
if (roundLayoutRadius > 0f) {
|
||||
canvas.clipPath(roundPath);
|
||||
}
|
||||
super.draw(canvas);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applySkin() {
|
||||
if (mBackgroundTintHelper != null) {
|
||||
mBackgroundTintHelper.applySkin();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,202 +0,0 @@
|
||||
package com.mogo.module.tanlu.view;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.util.TypedValue;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.mogo.module.tanlu.R;
|
||||
|
||||
|
||||
public class UploadFailedDialog extends Dialog {
|
||||
TextView txtOk;
|
||||
TextView txtCancel;
|
||||
// TextView txtTitle;
|
||||
TextView txtContent;
|
||||
TextView txtSubContent;
|
||||
|
||||
private int mContentSize = 0;
|
||||
private int mContentColor = 0;
|
||||
private int mBtnSize = 0;
|
||||
|
||||
private View.OnClickListener onOkListener, onCancelListener;
|
||||
|
||||
private String title, subContent, okText, cancelText;
|
||||
private CharSequence content;
|
||||
private boolean isAutoDismissDialog = true;
|
||||
|
||||
private int contentGravity = Gravity.CENTER;
|
||||
|
||||
private boolean isContentClickSpanEnable = false;
|
||||
|
||||
public UploadFailedDialog(@NonNull Context context) {
|
||||
super(context, R.style.Theme_AppCompat_Dialog);
|
||||
getWindow().setBackgroundDrawableResource(android.R.color.transparent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.tanlu_dialog_cutom_layout);
|
||||
getWindow().setBackgroundDrawableResource(android.R.color.transparent);
|
||||
|
||||
initView();
|
||||
|
||||
// if (TextUtils.isEmpty(title)) {
|
||||
// txtTitle.setVisibility(View.GONE);
|
||||
// } else {
|
||||
// txtTitle.setText(title);
|
||||
// txtTitle.setVisibility(View.VISIBLE);
|
||||
// }
|
||||
|
||||
if (mContentSize > 0){
|
||||
txtContent.setTextSize(TypedValue.COMPLEX_UNIT_PX,mContentSize);
|
||||
}
|
||||
|
||||
if (mContentColor > 0){
|
||||
txtContent.setTextColor(mContentColor);
|
||||
}
|
||||
|
||||
if ( content instanceof String ) {
|
||||
content = ( ( String ) content ).replace( "\\n", "\n" );
|
||||
}
|
||||
|
||||
txtContent.setText(content);
|
||||
if (TextUtils.isEmpty(subContent)) {
|
||||
txtSubContent.setVisibility(View.GONE);
|
||||
} else {
|
||||
txtSubContent.setVisibility(View.VISIBLE);
|
||||
txtSubContent.setText(subContent);
|
||||
}
|
||||
|
||||
if (mBtnSize > 0){
|
||||
txtOk.setTextSize(TypedValue.COMPLEX_UNIT_PX,mBtnSize);
|
||||
txtCancel.setTextSize(TypedValue.COMPLEX_UNIT_PX,mBtnSize);
|
||||
}
|
||||
|
||||
if (!TextUtils.isEmpty(okText)) {
|
||||
txtOk.setVisibility(View.VISIBLE);
|
||||
txtOk.setText(okText);
|
||||
} else {
|
||||
txtOk.setVisibility(View.GONE);
|
||||
}
|
||||
if (!TextUtils.isEmpty(cancelText)) {
|
||||
txtCancel.setVisibility(View.VISIBLE);
|
||||
txtCancel.setText(cancelText);
|
||||
} else {
|
||||
txtCancel.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
txtOk.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (isAutoDismissDialog) {
|
||||
dismiss();
|
||||
}
|
||||
if (onOkListener != null) {
|
||||
onOkListener.onClick(v);
|
||||
}
|
||||
}
|
||||
});
|
||||
txtCancel.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (isAutoDismissDialog) {
|
||||
dismiss();
|
||||
}
|
||||
if (onCancelListener != null) {
|
||||
onCancelListener.onClick(v);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
txtContent.setGravity( contentGravity );
|
||||
|
||||
if ( isContentClickSpanEnable ) {
|
||||
txtContent.setMovementMethod( LinkMovementMethod.getInstance() );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
txtOk = findViewById(R.id.txt_ok);
|
||||
txtCancel = findViewById(R.id.txt_cancel);
|
||||
// txtTitle = findViewById(R.id.txt_title);
|
||||
txtContent = findViewById(R.id.txt_content);
|
||||
txtSubContent = findViewById(R.id.txt_sub_content);
|
||||
}
|
||||
|
||||
public TextView getTxtCancel() {
|
||||
return txtCancel;
|
||||
}
|
||||
|
||||
// public void setTitle(String title) {
|
||||
// this.title = title;
|
||||
// }
|
||||
|
||||
public void setContent(CharSequence content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public void setSubContent(String subContent) {
|
||||
this.subContent = subContent;
|
||||
}
|
||||
|
||||
public void setContentGravity(int gravity) {
|
||||
contentGravity = gravity;
|
||||
}
|
||||
|
||||
public void hiddenBtnCancel() {
|
||||
txtCancel.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
public void setOnOkClickListener(String okText, View.OnClickListener onOkClickListener) {
|
||||
this.okText = okText;
|
||||
this.onOkListener = onOkClickListener;
|
||||
}
|
||||
|
||||
public void setOnOkClickListener(View.OnClickListener onOkClickListener) {
|
||||
setOnOkClickListener("确定", onOkClickListener);
|
||||
}
|
||||
|
||||
public void setOnCancelListener(String cancelText, View.OnClickListener onCancelListener) {
|
||||
this.cancelText = cancelText;
|
||||
this.onCancelListener = onCancelListener;
|
||||
}
|
||||
|
||||
public void setOnCancelListener(View.OnClickListener onCancelListener) {
|
||||
setOnCancelListener("取消", onCancelListener);
|
||||
}
|
||||
|
||||
public void setAutoDismissDialog(boolean autoDismissDialog) {
|
||||
isAutoDismissDialog = autoDismissDialog;
|
||||
}
|
||||
|
||||
public void setBtnTextSize(int size){
|
||||
mBtnSize = size;
|
||||
}
|
||||
|
||||
public void setContentTextSize(int size){
|
||||
mContentSize = size;
|
||||
}
|
||||
|
||||
public void setContentColor(int color){
|
||||
mContentColor = color;
|
||||
}
|
||||
|
||||
public int getContentGravity() {
|
||||
return contentGravity;
|
||||
}
|
||||
|
||||
public void setContentClickSpanEnable( boolean contentClickSpanEnable ) {
|
||||
isContentClickSpanEnable = contentClickSpanEnable;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:ordering="sequentially">
|
||||
|
||||
<set android:ordering="together">
|
||||
<objectAnimator
|
||||
android:duration="200"
|
||||
android:propertyName="scaleX"
|
||||
android:valueTo="0.95f" />
|
||||
<objectAnimator
|
||||
android:duration="200"
|
||||
android:propertyName="scaleY"
|
||||
android:valueTo="0.95f" />
|
||||
</set>
|
||||
|
||||
<set android:ordering="together">
|
||||
<objectAnimator
|
||||
android:duration="200"
|
||||
android:propertyName="scaleX"
|
||||
android:valueTo="1f" />
|
||||
<objectAnimator
|
||||
android:duration="200"
|
||||
android:propertyName="scaleY"
|
||||
android:valueTo="1f" />
|
||||
</set>
|
||||
|
||||
<set android:ordering="together">
|
||||
<objectAnimator
|
||||
android:duration="200"
|
||||
android:propertyName="scaleX"
|
||||
android:valueTo="1.25f" />
|
||||
<objectAnimator
|
||||
android:duration="200"
|
||||
android:propertyName="scaleY"
|
||||
android:valueTo="1.25f" />
|
||||
</set>
|
||||
|
||||
<set android:ordering="together">
|
||||
<objectAnimator
|
||||
android:duration="200"
|
||||
android:propertyName="scaleX"
|
||||
android:valueTo="0.95f" />
|
||||
|
||||
<objectAnimator
|
||||
android:duration="200"
|
||||
android:propertyName="scaleY"
|
||||
android:valueTo="0.95f" />
|
||||
</set>
|
||||
|
||||
<set android:ordering="together">
|
||||
<objectAnimator
|
||||
android:duration="200"
|
||||
android:propertyName="scaleX"
|
||||
android:valueTo="1f" />
|
||||
|
||||
<objectAnimator
|
||||
android:duration="200"
|
||||
android:propertyName="scaleY"
|
||||
android:valueTo="1f" />
|
||||
</set>
|
||||
|
||||
</set>
|
||||
@@ -1,31 +0,0 @@
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:ordering="sequentially">
|
||||
<objectAnimator
|
||||
android:duration="100"
|
||||
android:propertyName="translationX"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="-2"
|
||||
android:valueType="floatType" />
|
||||
|
||||
<objectAnimator
|
||||
android:duration="100"
|
||||
android:propertyName="translationX"
|
||||
android:valueFrom="-2"
|
||||
android:valueTo="0"
|
||||
android:valueType="floatType" />
|
||||
|
||||
<objectAnimator
|
||||
android:duration="100"
|
||||
android:propertyName="translationX"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="2"
|
||||
android:valueType="floatType" />
|
||||
|
||||
<objectAnimator
|
||||
android:duration="100"
|
||||
android:propertyName="translationX"
|
||||
android:valueFrom="2"
|
||||
android:valueTo="0"
|
||||
android:valueType="floatType" />
|
||||
|
||||
</set>
|
||||
|
Before Width: | Height: | Size: 7.7 KiB |
|
Before Width: | Height: | Size: 715 B |
|
Before Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 843 B |
|
Before Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 788 B |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 805 B |