add event
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
package com.mogo.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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.mogo.tanlu.receiver
|
||||
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.util.Log
|
||||
import com.mogo.tanlu.model.event.VoiceRoadInfo
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
|
||||
/**
|
||||
* xx堵不堵,接收关键字
|
||||
*/
|
||||
class RoadInfoReceiver : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
if (intent.action == "com.zhidao.roadcondition.roadinfo"){
|
||||
var keyWords = intent.getStringExtra("keywords")
|
||||
var city = intent.getStringExtra("city")
|
||||
Log.d("RoadInfoReceiver", "keyWords = $keyWords ---->city = $city")
|
||||
EventBus.getDefault().post(VoiceRoadInfo(keyWords, city))
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user