public void onEvent(LocationItemClickEvent event) {
   if (null != event && null != event.message && event.message instanceof AVIMLocationMessage) {
     AVIMLocationMessage locationMessage = (AVIMLocationMessage) event.message;
     LocationActivity.startToSeeLocationDetail(
         this,
         locationMessage.getLocation().getLatitude(),
         locationMessage.getLocation().getLongitude());
   }
 }
 @Override
 public void bindData(Object o) {
   super.bindData(o);
   AVIMMessage message = (AVIMMessage) o;
   if (message instanceof AVIMLocationMessage) {
     final AVIMLocationMessage locMsg = (AVIMLocationMessage) message;
     contentView.setText(locMsg.getText());
   }
 }
Ejemplo n.º 3
0
 @Override
 protected void onLocationMessageViewClicked(AVIMLocationMessage locationMessage) {
   LocationActivity.startToSeeLocationDetail(
       this,
       locationMessage.getLocation().getLatitude(),
       locationMessage.getLocation().getLongitude());
 }
 @Override
 protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
   super.onActivityResult(requestCode, resultCode, intent);
   if (resultCode == RESULT_OK) {
     switch (requestCode) {
       case LOCATION_REQUEST:
         final double latitude = intent.getDoubleExtra(LocationActivity.LATITUDE, 0);
         final double longitude = intent.getDoubleExtra(LocationActivity.LONGITUDE, 0);
         final String address = intent.getStringExtra(LocationActivity.ADDRESS);
         if (!TextUtils.isEmpty(address)) {
           AVIMLocationMessage locationMsg = new AVIMLocationMessage();
           locationMsg.setLocation(new AVGeoPoint(latitude, longitude));
           locationMsg.setText(address);
           chatFragment.sendMessage(locationMsg);
         } else {
           showToast(R.string.chat_cannotGetYourAddressInfo);
         }
         break;
       case QUIT_GROUP_REQUEST:
         finish();
         break;
     }
   }
 }