opt'
This commit is contained in:
@@ -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,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,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,8 +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 //结束导航
|
||||
@@ -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_TEST = "http://dzt-test.zhidaohulian.com";
|
||||
public static final String HOST_PRODUCT = "https://dzt.zhidaohulian.com";
|
||||
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
package com.mogo.module.tanlu.constant;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-24
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class TanluConstants {
|
||||
|
||||
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 UPLOAD_ROAD_CONDITION = "command_upload_roadcondition";
|
||||
//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 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_VOICE_SEARCH = "CarNet_Voice_Search";
|
||||
|
||||
//视频播放
|
||||
public static final String CARNET_USER_VIDEO_PLAY = "CarNet_user_video_play";
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,98 +0,0 @@
|
||||
package com.mogo.module.tanlu.fragment;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.map.listener.IMogoMapListener;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.navi.IMogoNaviListener;
|
||||
import com.mogo.module.tanlu.callback.DataSetChangedAdapter;
|
||||
import com.mogo.service.module.IMogoModuleLifecycle;
|
||||
import com.mogo.service.module.IMogoModuleProvider;
|
||||
import com.mogo.service.module.ModuleType;
|
||||
import com.mogo.module.tanlu.constant.TanluConstants;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-24
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
@Route( path = TanluConstants.TAG )
|
||||
public class TanluCardViewProvider implements IMogoModuleProvider {
|
||||
|
||||
private static final String TAG = "TanluCardViewProvider";
|
||||
private TanluCardViewFragment fragment;
|
||||
|
||||
@Override
|
||||
public Fragment createFragment( Context context, Bundle data ) {
|
||||
fragment = new TanluCardViewFragment();
|
||||
fragment.setArguments( data );
|
||||
Logger.i( TAG, "createFragment" );
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
TanluServiceHandler.init( context );
|
||||
TanluServiceHandler.getDataManager().registerDataListener( TanluConstants.MODEL_NAME, DataSetChangedAdapter.getInstance() );
|
||||
Logger.d(TAG, "init ----------> ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModuleName() {
|
||||
return "CARD_TYPE_ROAD_CONDITION";
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoModuleLifecycle getCardLifecycle() {
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View createView( Context context ) {
|
||||
// don't
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoMapListener getMapListener() {
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getType() {
|
||||
return ModuleType.TYPE_CARD_FRAGMENT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoNaviListener getNaviListener() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoLocationListener getLocationListener() {
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoMarkerClickListener getMarkerClickListener() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAppPackage() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAppName() {
|
||||
return "探路";
|
||||
}
|
||||
}
|
||||
@@ -1,79 +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.marker.IMogoMarkerManager;
|
||||
import com.mogo.map.navi.IMogoNavi;
|
||||
import com.mogo.map.search.poisearch.IMogoPoiSearch;
|
||||
import com.mogo.map.search.poisearch.query.MogoPoiSearchQuery;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.datamanager.IMogoDataChangedListener;
|
||||
import com.mogo.service.datamanager.IMogoDataManager;
|
||||
import com.mogo.service.imageloader.IMogoImageloader;
|
||||
import com.mogo.service.map.IMogoMapService;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-30
|
||||
* <p>
|
||||
* 持有服务接口实例
|
||||
*/
|
||||
public class TanluServiceHandler {
|
||||
|
||||
private static IMogoMapService mMapService;
|
||||
private static IMogoPoiSearch mPoiSearch;
|
||||
private static IMogoLocationClient mLocationClient;
|
||||
private static IMogoMarkerManager mMarkerManager;
|
||||
private static IMogoNavi mNavi;
|
||||
private static IMogoMapUIController mMapUIController;
|
||||
private static IMogoImageloader mImageloader;
|
||||
private static IMogoDataManager mDataManager;
|
||||
|
||||
public static void init( Context context ) {
|
||||
mMapService = ( IMogoMapService ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICES_MAP ).navigation( context );
|
||||
mMapService = ( IMogoMapService ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICES_MAP ).navigation( context );
|
||||
mImageloader = ( IMogoImageloader ) ARouter.getInstance().build( MogoServicePaths.PATH_UTILS_IMAGE_LOADER ).navigation( context );
|
||||
mPoiSearch = mMapService.getPoiSearch( context, new MogoPoiSearchQuery() );
|
||||
// mLocationClient = mMapService.getLocationClient( context );
|
||||
mLocationClient = mMapService.getSingletonLocationClient(context);
|
||||
mMarkerManager = mMapService.getMarkerManager( context );
|
||||
mNavi = mMapService.getNavi( context );
|
||||
mMapUIController = mMapService.getMapUIController();
|
||||
mDataManager = (IMogoDataManager)ARouter.getInstance().build( MogoServicePaths.PATH_DATA_MANAGER ).navigation(context);
|
||||
}
|
||||
|
||||
public static IMogoMapService getMapService() {
|
||||
return mMapService;
|
||||
}
|
||||
|
||||
public static IMogoPoiSearch getPoiSearch() {
|
||||
return mPoiSearch;
|
||||
}
|
||||
|
||||
public static IMogoLocationClient getLocationClient() {
|
||||
return mLocationClient;
|
||||
}
|
||||
|
||||
public static IMogoMarkerManager getMarkerManager() {
|
||||
return mMarkerManager;
|
||||
}
|
||||
|
||||
public static IMogoNavi getNavi() {
|
||||
return mNavi;
|
||||
}
|
||||
|
||||
public static IMogoMapUIController getMapUIController() {
|
||||
return mMapUIController;
|
||||
}
|
||||
|
||||
public static IMogoImageloader getImageloader() {
|
||||
return mImageloader;
|
||||
}
|
||||
|
||||
public static IMogoDataManager getDataManager() {
|
||||
return mDataManager;
|
||||
}
|
||||
}
|
||||
@@ -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,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,348 +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.module.tanlu.callback.AlongTheWayCallback;
|
||||
import com.mogo.module.tanlu.callback.NaviCallback;
|
||||
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.net.TanluApiService;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.network.IMogoNetwork;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.RequestOptions;
|
||||
import com.mogo.utils.storage.SharedPrefsMgr;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
import static com.mogo.commons.network.Utils.getSn;
|
||||
|
||||
/**
|
||||
* @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, DebugConfig.getNetMode() == 3 ? HttpConst.HOST_PRODUCT : 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);
|
||||
Log.d(TAG, " getNaviInfo naviInfo =" + naviInfo);
|
||||
NaviLatLngInfo naviLatLngInfo = new Gson().fromJson(naviInfo, NaviLatLngInfo.class);
|
||||
Log.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, final UploadShareCallback callback) {
|
||||
Gson gson = new Gson();
|
||||
UploadShareRoadInfo uploadShareRoadInfo = new UploadShareRoadInfo(poiType, poiImgUrl, nickname, headImgUrl, new Center(lat, lon), address);
|
||||
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());
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 组装需要的请求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);
|
||||
Log.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());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,26 +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;
|
||||
private Center location;
|
||||
private String address;
|
||||
|
||||
public UploadShareRoadInfo(String poiType, String poiImgUrl, String nickname,
|
||||
String headImgUrl, Center location, String address) {
|
||||
this.poiType = poiType;
|
||||
this.poiImgUrl = poiImgUrl;
|
||||
this.nickname = nickname;
|
||||
this.headImgUrl = headImgUrl;
|
||||
this.location = location;
|
||||
this.address = address;
|
||||
}
|
||||
}
|
||||
@@ -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,23 +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 imageUrl; //上传完cos图片
|
||||
public double lon; //经度
|
||||
public double lat; //纬度
|
||||
|
||||
public MarkerInfo(String type, String imageUrl, double lon, double lat) {
|
||||
this.type = type;
|
||||
this.imageUrl = imageUrl;
|
||||
this.lon = lon;
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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,19 +0,0 @@
|
||||
package com.mogo.module.tanlu.model.event;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description marker数据
|
||||
* @since 2020-01-08
|
||||
*/
|
||||
public class VoiceRoadInfo implements Serializable {
|
||||
public String keyword;
|
||||
public String city;
|
||||
|
||||
public VoiceRoadInfo(String keyword, String city) {
|
||||
this.keyword = keyword;
|
||||
this.city = city;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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,67 +0,0 @@
|
||||
package com.mogo.module.tanlu.net;
|
||||
|
||||
import com.mogo.commons.data.BaseData;
|
||||
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.VoiceSearchResult;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
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);
|
||||
|
||||
|
||||
}
|
||||
@@ -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.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 imageUrl = intent.getStringExtra("imageUrl")
|
||||
var lat = intent.getDoubleExtra("lat",0.0)
|
||||
var lon = intent.getDoubleExtra("lon",0.0) //经度
|
||||
Log.d("MarkerInfoReceiver", "type =" + type + "---->lat =" + lat + "----lon =" + lon + "---imageUrl =" + imageUrl)
|
||||
EventBus.getDefault().post(MarkerInfo(type, imageUrl,lon, lat))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +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 com.mogo.module.tanlu.model.event.VoiceRoadInfo
|
||||
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,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,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,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,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 = "yy/MM/dd kk:mm:ss"
|
||||
|
||||
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,31 +0,0 @@
|
||||
package com.mogo.module.tanlu.util;
|
||||
|
||||
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)));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,149 +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)
|
||||
Logger.d("liyz", "FullMediaActivityvideoUrl = $videoUrl --->thumbUrl = $thumbUrl")
|
||||
Logger.d("liyz", "FullMediaActivity address = $address --->generateTime = $generateTime")
|
||||
}
|
||||
|
||||
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() {
|
||||
Log.d("liyz", "FullMediaActivity ----> onAutoCompletion ")
|
||||
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
|
||||
|
||||
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.mipmap.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()
|
||||
}
|
||||
|
||||
Log.d("liyz", "MediaCoverVideoPlayer onAutoCompletion ------->")
|
||||
}
|
||||
|
||||
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,166 +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.mogo.module.tanlu.R
|
||||
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
|
||||
|
||||
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)
|
||||
// Log.e("liyz", "setProgressAndTime progress = $progress --->currentTime = $currentTime --->totalTime = $totalTime")
|
||||
if (progress != 0) {
|
||||
mProgressBar.progress = progress
|
||||
}
|
||||
}
|
||||
|
||||
fun loadCoverImage(url: String, mContext: Context) {
|
||||
Glide.with(mContext.applicationContext)
|
||||
.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.mipmap.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
|
||||
Log.d("liyz", "changeUiToCompleteShow ------------>")
|
||||
}
|
||||
|
||||
override fun hideAllWidget() {
|
||||
super.hideAllWidget()
|
||||
mBottomContainer.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
override fun changeUiToPrepareingClear() {
|
||||
super.changeUiToPrepareingClear()
|
||||
mBottomContainer.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
override fun changeUiToPlayingBufferingClear() {
|
||||
super.changeUiToPlayingBufferingClear()
|
||||
mBottomContainer.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
override fun changeUiToClear() {
|
||||
super.changeUiToClear()
|
||||
mBottomContainer.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
override fun changeUiToCompleteClear() {
|
||||
super.changeUiToCompleteClear()
|
||||
mBottomContainer.visibility = View.INVISIBLE
|
||||
}
|
||||
|
||||
override fun onAutoCompletion() {
|
||||
super.onAutoCompletion()
|
||||
mProgressBar.progress = 0
|
||||
}
|
||||
|
||||
override fun showWifiDialog() {
|
||||
//直接播放,不显示WIFI对话框
|
||||
startPlayLogic()
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
mProgressBar.progress = 0
|
||||
mFullPauseBitmap = null
|
||||
}
|
||||
|
||||
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)
|
||||
if (GSYVideoType.getRenderType() != GSYVideoType.TEXTURE) {
|
||||
if (mThumbImageViewLayout != null && mThumbImageViewLayout.visibility == View.VISIBLE) {
|
||||
mThumbImageViewLayout.visibility = View.INVISIBLE
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,22 +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))
|
||||
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,57 +0,0 @@
|
||||
package com.mogo.module.tanlu.voice
|
||||
|
||||
import com.zhidao.auto.platform.voice.VoiceClient
|
||||
|
||||
/**
|
||||
* @description 声音控制类
|
||||
*
|
||||
* @author lixiaopeng
|
||||
* @since 2019-11-01
|
||||
*/
|
||||
object VoiceController {
|
||||
private lateinit var voiceClient: VoiceClient
|
||||
|
||||
// fun initVoice() {
|
||||
// voiceClient = VoiceClient.getInstance(BaseApplication.getAppContext())
|
||||
// }
|
||||
|
||||
/**
|
||||
* 设置语音命令回调接口
|
||||
* @param callBack
|
||||
*/
|
||||
fun setCallBack(callBack: VoiceClient.VoiceCmdCallBack) {
|
||||
voiceClient.setCallBack(callBack)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param speakText 语音播报内容
|
||||
*/
|
||||
fun speakVoice(speakText: String) {
|
||||
voiceClient.speakDefault(speakText)
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册免唤醒命令
|
||||
* @param customType 命令
|
||||
* @param customWakeupCmd 命令对应的唤醒词集合
|
||||
*/
|
||||
fun registerCustomWakeupCmd(customType: String, customWakeupCmd: Array<String>) {
|
||||
voiceClient.registerCustomWakeupCmd(customType, customWakeupCmd)
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消免唤醒命令
|
||||
* @param customType 命令
|
||||
*/
|
||||
fun unRegisterCustomWakeupCmd(customType: String) {
|
||||
voiceClient.unRegisterCustomWakeupCmd(customType)
|
||||
}
|
||||
|
||||
/**
|
||||
* 释放资源(界面销毁的时候调用)
|
||||
*/
|
||||
fun release() {
|
||||
voiceClient.release()
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user