add push broadcastreciver and opt ui
This commit is contained in:
@@ -14,6 +14,13 @@
|
||||
</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>
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -15,4 +15,8 @@ public class TanluConstants {
|
||||
|
||||
public static final String UPLOAD_ROAD_CONDITION = "upload_road_condition";
|
||||
|
||||
public static final String SPECIFIEDROAD_SEARCH = "com.zhidao.pathfinder.specifiedroad.search";
|
||||
public static final String NEARBYROAD_SEARCH = "com.zhidao.pathfinder.nearbyroad.search";
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -63,6 +63,7 @@ import com.mogo.module.tanlu.model.PathLineResult;
|
||||
import com.mogo.module.tanlu.model.TanluModelData;
|
||||
import com.mogo.module.tanlu.model.VoiceSearchResult;
|
||||
import com.mogo.module.tanlu.model.event.MarkerInfo;
|
||||
import com.mogo.module.tanlu.model.event.PushTypeInfo;
|
||||
import com.mogo.module.tanlu.util.Utils;
|
||||
import com.mogo.module.tanlu.video.FullMediaActivity;
|
||||
import com.mogo.module.tanlu.video.SimpleCoverVideoPlayer;
|
||||
@@ -130,8 +131,8 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
|
||||
//media
|
||||
private GSYVideoOptionBuilder gsyVideoOptionBuilder = new GSYVideoOptionBuilder();
|
||||
private String mVideoUrl = "http://ivi.bupt.edu.cn/hls/cctv1hd.m3u8";
|
||||
private String mImageUrl = "https://oimagec4.ydstatic.com/image?id=-5397300958976572132&product=adpublish&w=520&h=347";
|
||||
private String mVideoUrl = "";
|
||||
private String mImageUrl = "";
|
||||
private String mTitle = "";
|
||||
private long mGenerateTime = 0;
|
||||
private IMogoImageloader mogoImageloader;
|
||||
@@ -180,9 +181,7 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
simpleCoverVideoPlayer.setVisibility(View.VISIBLE);
|
||||
autoZoomInImageView.setVisibility(View.GONE);
|
||||
|
||||
//视频配置 TODO 需要去掉
|
||||
// gsyVideoOptionBuilder.setUrl(mVideoUrl).setCacheWithPlay(false).setPlayTag(TAG)
|
||||
// .build(simpleCoverVideoPlayer);
|
||||
//视频点击
|
||||
simpleCoverVideoPlayer.getStartButton().setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
@@ -293,6 +292,7 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
getViewLifecycleOwner().getLifecycle().addObserver(mPresenter);
|
||||
Logger.d(TAG, "onActivityCreated -------> ");
|
||||
EventBus.getDefault().register(this);
|
||||
initInterface();
|
||||
initModelData();
|
||||
@@ -300,8 +300,7 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
initMap();
|
||||
initStrings();
|
||||
initListener();
|
||||
|
||||
//TODO切换探路卡片
|
||||
//TODO 切换探路卡片
|
||||
// iMogoCardManager.switch2(TanluConstants.MODEL_NAME);
|
||||
}
|
||||
|
||||
@@ -358,6 +357,9 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
@Override
|
||||
public boolean onMarkerClicked(IMogoMarker marker) {
|
||||
//点击marker以后,确认他的位置?然后点击下一个操作 TODO
|
||||
mEmptyLayout.setVisibility(View.GONE);
|
||||
mRootLayout.setVisibility(View.VISIBLE);
|
||||
|
||||
MarkerExploreWay exploreWay = extractFromMarker(marker);
|
||||
if (exploreWay == null) {
|
||||
return false;
|
||||
@@ -404,13 +406,16 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
* 注册listener监听
|
||||
*/
|
||||
private void initListener() {
|
||||
Logger.d(TAG, " initListener ------> ");
|
||||
//某某路堵不堵,某某地点堵不堵,附近堵不堵,播放路况 TODO
|
||||
//唤醒
|
||||
mogoIntentManager.registerIntentListener(MogoReceiver.ADAS_ACTION, mogoIntentListener);
|
||||
mogoIntentManager.registerIntentListener(TanluConstants.SPECIFIEDROAD_SEARCH, mogoIntentListener);
|
||||
mogoIntentManager.registerIntentListener(TanluConstants.NEARBYROAD_SEARCH, mogoIntentListener);
|
||||
//免唤醒
|
||||
AIAssist.getInstance(getActivity()).registerUnWakeupCommandCallback(TanluConstants.UPLOAD_ROAD_CONDITION, mogoVoiceListener);
|
||||
// AIAssist.getInstance(getActivity()).registerUnWakeupCommandCallback(TanluConstants.UPLOAD_ROAD_CONDITION, mogoVoiceListener);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 唤醒语音
|
||||
*/
|
||||
@@ -422,7 +427,20 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
mKeywords = jsonObject.get("location").toString();
|
||||
Logger.d(TAG, "mogoIntentListener mKeywords = " + mKeywords);
|
||||
handleActionFoo(mKeywords);
|
||||
|
||||
if (intentStr.equals(TanluConstants.SPECIFIEDROAD_SEARCH)) { //地点堵不堵
|
||||
|
||||
} else if (intentStr.equals(TanluConstants.NEARBYROAD_SEARCH)) { //附件
|
||||
|
||||
// } else if (intentStr.equals()) { //上报路况
|
||||
// sendShareReceiver("1");
|
||||
//
|
||||
// } else if (intentStr.equals()) { //
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
@@ -435,8 +453,7 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
public void onCmdSelected(String cmd) {
|
||||
Logger.e(TAG, "免唤醒 onCmdSelected mogoVoiceListener cmd =" + cmd);
|
||||
if (cmd.equals(TanluConstants.UPLOAD_ROAD_CONDITION)) {
|
||||
//
|
||||
Logger.d(TAG, "");
|
||||
sendShareReceiver("1");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -480,20 +497,6 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
* 处理路线数据信息,msgType
|
||||
*/
|
||||
private void handleRoadLineMessage() {
|
||||
// mMogoSocketManager = (IMogoSocketManager) ARouter.getInstance().build(MogoServicePaths.PATH_SOCKET_MANAGER).navigation();
|
||||
// mMogoSocketManager.registerOnMessageListener(401005, new IMogoOnMessageListener<MarkerResponse>() {
|
||||
// @Override
|
||||
// public Class<MarkerResponse> target() {
|
||||
// return MarkerResponse.class;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onMsgReceived(MarkerResponse obj) {
|
||||
// Logger.e(TAG, "handleRoadLineMessage onMsgReceived obj= " + obj);
|
||||
// }
|
||||
// });
|
||||
|
||||
|
||||
//TODO 广播类型判断
|
||||
// getNavigationLineData();
|
||||
// getRoadLineData();
|
||||
@@ -612,6 +615,7 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
simpleCoverVideoPlayer.setVisibility(View.VISIBLE);
|
||||
//视频配置
|
||||
mVideoUrl = videoUrl;
|
||||
simpleCoverVideoPlayer.loadCoverImage(mImageUrl, getContext());
|
||||
gsyVideoOptionBuilder.setUrl(videoUrl).setCacheWithPlay(false).setPlayTag(TAG)
|
||||
.build(simpleCoverVideoPlayer);
|
||||
if (mImageUrl == null) {
|
||||
@@ -788,6 +792,7 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
getViewLifecycleOwner().getLifecycle().removeObserver(mPresenter);
|
||||
TanluServiceHandler.getLocationClient().removeLocationListener(this);
|
||||
mMogoRegisterCenter.unregisterMogoNaviListener(TanluConstants.MODEL_NAME);
|
||||
mogoIntentManager.unregisterIntentListener(MogoReceiver.ADAS_ACTION);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -822,8 +827,8 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
.longitude(event.lon);
|
||||
|
||||
IMogoMarker marker = mMarkerManager.addMarker("share_tag", options);
|
||||
|
||||
//TODO 请求分享接口
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -833,6 +838,22 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* push 类型,1为导航数据,2为通勤族
|
||||
*
|
||||
* @param event
|
||||
*/
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onPushInfo(final PushTypeInfo event) {
|
||||
Logger.d(TAG, "onPushInfo ----event.type =" + event.type);
|
||||
if (event.type.equals("1")) {
|
||||
getNaviRoadLineInfo();
|
||||
} else if (event.type.equals("2")) {
|
||||
getRoadLineData();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导航路线数据事件
|
||||
*/
|
||||
@@ -900,7 +921,7 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制线路
|
||||
* 绘制线路 TODO
|
||||
*/
|
||||
private void drawMapLine(List<Center> pointList) {
|
||||
int intervalNum = Utils.getIntervalValue(pointList.size());
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
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.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 type = intent.getStringExtra("type")
|
||||
Log.d("PushReceiver", "type = $type")
|
||||
EventBus.getDefault().post(PushTypeInfo(type))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -56,12 +56,11 @@ class SimpleCoverVideoPlayer : StandardGSYVideoPlayer {
|
||||
}
|
||||
}
|
||||
|
||||
// fun loadCoverImage(url: String, mContext: Context) {
|
||||
// Glide.with(mContext.applicationContext)
|
||||
// .load(url)
|
||||
// .error(R.color.color_303447)
|
||||
// .into(coverImage)
|
||||
// }
|
||||
fun loadCoverImage(url: String, mContext: Context) {
|
||||
Glide.with(mContext.applicationContext)
|
||||
.load(url)
|
||||
.into(coverImage)
|
||||
}
|
||||
|
||||
override fun updateStartImage() {
|
||||
when (mCurrentState) {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:radius="5dp" />
|
||||
<solid android:color="@color/color_DADAE2"/>
|
||||
<corners android:radius="@dimen/dp_10" />
|
||||
<stroke android:color="@color/color_59FFFFFF"
|
||||
android:width="@dimen/dp_2"/>
|
||||
<!-- <solid android:color="@color/color_DADAE2"/>-->
|
||||
</shape>
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<gradient
|
||||
android:angle="270"
|
||||
android:endColor="#323346"
|
||||
android:startColor="#6E7091" />
|
||||
<corners android:radius="@dimen/dp_20" />
|
||||
|
||||
</shape>
|
||||
@@ -3,7 +3,7 @@
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="@dimen/dp_660"
|
||||
android:layout_height="@dimen/dp_660"
|
||||
android:background="@drawable/shape_bg_222533_10px">
|
||||
android:background="@drawable/tanlu_gradual_change_bg">
|
||||
|
||||
<!--正常显示数据-->
|
||||
<RelativeLayout
|
||||
@@ -21,15 +21,15 @@
|
||||
android:id="@+id/tv_information_media_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/dp_32"
|
||||
android:layout_marginTop="@dimen/dp_50"
|
||||
android:layout_marginRight="@dimen/dp_32"
|
||||
android:layout_marginLeft="@dimen/dp_24"
|
||||
android:layout_marginTop="@dimen/dp_58"
|
||||
android:layout_marginRight="@dimen/dp_24"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center_vertical"
|
||||
android:maxLines="1"
|
||||
android:text="@string/main_empty_location"
|
||||
android:textColor="@color/color_3"
|
||||
android:textSize="@dimen/dp_36"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/dp_34"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
@@ -37,11 +37,11 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/tv_information_media_content"
|
||||
android:layout_marginLeft="@dimen/dp_32"
|
||||
android:layout_marginTop="@dimen/dp_4"
|
||||
android:layout_marginLeft="@dimen/dp_24"
|
||||
android:layout_marginTop="@dimen/dp_1"
|
||||
android:layout_marginBottom="@dimen/dp_10"
|
||||
android:text="666KM"
|
||||
android:textColor="@color/color_666666"
|
||||
android:textColor="@color/color_99FFFFFF"
|
||||
android:textSize="@dimen/dp_26"
|
||||
android:textStyle="bold" />
|
||||
|
||||
@@ -52,9 +52,9 @@
|
||||
android:layout_below="@+id/tv_information_media_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginRight="@dimen/dp_32"
|
||||
android:layout_marginRight="@dimen/dp_24"
|
||||
android:text="2019-10-10"
|
||||
android:textColor="@color/color_999999"
|
||||
android:textColor="@color/color_99FFFFFF"
|
||||
android:textSize="@dimen/dp_26" />
|
||||
</RelativeLayout>
|
||||
|
||||
@@ -64,8 +64,8 @@
|
||||
android:layout_width="@dimen/dp_596"
|
||||
android:layout_height="@dimen/dp_355"
|
||||
android:layout_below="@+id/layout_top_view"
|
||||
android:layout_marginLeft="@dimen/dp_32"
|
||||
android:layout_marginRight="@dimen/dp_32"
|
||||
android:layout_marginLeft="@dimen/dp_24"
|
||||
android:layout_marginRight="@dimen/dp_24"
|
||||
android:background="@drawable/shape_bg_222533_9px">
|
||||
|
||||
<com.mogo.module.tanlu.video.SimpleCoverVideoPlayer
|
||||
@@ -85,14 +85,13 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/media_layout"
|
||||
android:layout_marginTop="@dimen/dp_20"
|
||||
android:layout_marginLeft="@dimen/dp_32"
|
||||
android:layout_marginRight="@dimen/dp_32"
|
||||
android:layout_marginBottom="@dimen/dp_42">
|
||||
android:layout_marginTop="@dimen/dp_30"
|
||||
android:layout_marginLeft="@dimen/dp_24"
|
||||
android:layout_marginRight="@dimen/dp_24">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_previous_res"
|
||||
android:layout_width="@dimen/dp_284"
|
||||
android:layout_width="@dimen/dp_300"
|
||||
android:layout_height="@dimen/dp_90"
|
||||
android:layout_centerVertical="true"
|
||||
android:paddingLeft="@dimen/dp_40"
|
||||
@@ -101,12 +100,12 @@
|
||||
android:gravity="center_vertical"
|
||||
android:drawablePadding="@dimen/dp_40"
|
||||
android:text="@string/tanlu_previous"
|
||||
android:textColor="@color/color_545362"
|
||||
android:textSize="@dimen/dp_26" />
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/dp_28" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_next_res"
|
||||
android:layout_width="@dimen/dp_284"
|
||||
android:layout_width="@dimen/dp_300"
|
||||
android:layout_height="@dimen/dp_90"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
@@ -117,8 +116,8 @@
|
||||
android:drawableRight="@drawable/media_next"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/tanlu_next"
|
||||
android:textColor="@color/color_545362"
|
||||
android:textSize="@dimen/dp_26" />
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/dp_28" />
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
@@ -126,17 +125,17 @@
|
||||
<!--空数据显示-->
|
||||
<RelativeLayout
|
||||
android:id="@+id/layout_empty_data_show"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="@dimen/dp_660"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:gravity="center_horizontal"
|
||||
android:visibility="gone">
|
||||
android:visibility="visible">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_main_empty"
|
||||
android:layout_width="@dimen/dp_420"
|
||||
android:layout_height="@dimen/dp_420"
|
||||
android:layout_marginTop="@dimen/dp_20"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_122"
|
||||
android:src="@mipmap/main_view_empty_bg" />
|
||||
|
||||
<TextView
|
||||
@@ -147,7 +146,7 @@
|
||||
android:layout_marginTop="@dimen/dp_70"
|
||||
android:text="@string/main_empty_content"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/dp_32" />
|
||||
android:textSize="@dimen/dp_34" />
|
||||
</RelativeLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -34,7 +34,9 @@
|
||||
<color name="color_DADAE2">#DADAE2</color>
|
||||
<color name="color_545362">#545362</color>
|
||||
<color name="color_191C25">#99191C25</color>
|
||||
<color name="color_666666">#666666</color>
|
||||
<color name="color_666666">#99666666</color>
|
||||
<color name="color_999999">#999999</color>
|
||||
<color name="color_99FFFFFF">#99FFFFFF</color>
|
||||
<color name="color_59FFFFFF">#59FFFFFF</color>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<string name="start_already_agreement">已同意</string>
|
||||
<string name="splash_agreement_bt">探路共享计划 >> </string>
|
||||
<string name="splash_agreement_dialog_title">探路APP用户服务协议</string>
|
||||
<string name="main_empty_content"><Data><![CDATA[<font color="#69718B">未找到其他用户分享的路况,<br/>您可以试试</font><font color="#F7B500">上报路况</font>]]></Data></string>
|
||||
<string name="main_empty_content"><Data><![CDATA[<font color="#8F95AA">未找到其他用户分享的路况,<br/>您可以试试</font><font color="#51B0FF">上报路况</font>]]></Data></string>
|
||||
<string name="main_empty_location">未知区域</string>
|
||||
<string name="custom_send_road_condition">上报路况</string>
|
||||
<string name="text_searching_information">正在更新情报数据</string>
|
||||
|
||||
Reference in New Issue
Block a user