io.rong.message.LocationMessage Java Examples

The following examples show how to use io.rong.message.LocationMessage. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AMAPLocationActivity.java    From sealtalk-android with MIT License 6 votes vote down vote up
@Override
public void onRegeocodeSearched(RegeocodeResult regeocodeResult, int i) {
    if (i == 0) {
        if (regeocodeResult != null && regeocodeResult.getRegeocodeAddress() != null) {
            endAnim();
            centerMarker.setIcon(successDescripter);
            RegeocodeAddress regeocodeAddress = regeocodeResult.getRegeocodeAddress();
            String formatAddress = regeocodeResult.getRegeocodeAddress().getFormatAddress();
            String shortAdd = formatAddress.replace(regeocodeAddress.getProvince(), "").replace(regeocodeAddress.getCity(), "").replace(regeocodeAddress.getDistrict(), "");
            tvCurLocation.setText(shortAdd);
            double latitude = regeocodeResult.getRegeocodeQuery().getPoint().getLatitude();
            double longitude = regeocodeResult.getRegeocodeQuery().getPoint().getLongitude();
            mMsg = LocationMessage.obtain(latitude, longitude, shortAdd, getMapUrl(latitude, longitude));
            NLog.e("LocationChange", shortAdd + latitude + "----" + longitude);
        } else {
            NToast.shortToast(AMAPLocationActivity.this, "没有搜索到结果");
        }
    } else {
        NToast.shortToast(AMAPLocationActivity.this, "搜索失败,请检查网络");
    }
}
 
Example #2
Source File: AMAPLocationActivity.java    From sealtalk-android with MIT License 6 votes vote down vote up
@Override
public void onLocationChanged(AMapLocation aMapLocation) {
    if (aMapLocation != null && aMapLocation.getAMapException().getErrorCode() == 0) {
        if (listener != null) {
            listener.onLocationChanged(aMapLocation);// 显示系统小蓝点
        }
        myLocation = new LatLng(aMapLocation.getLatitude(), aMapLocation.getLongitude());//获取当前位置经纬度
        tvCurLocation.setText(aMapLocation.getRoad() + aMapLocation.getStreet() + aMapLocation.getPoiName());//当前位置信息

        double latitude = aMapLocation.getLatitude();
        double longitude = aMapLocation.getLongitude();
        mMsg = LocationMessage.obtain(latitude, longitude, aMapLocation.getRoad() + aMapLocation.getStreet() + aMapLocation.getPoiName(), getMapUrl(latitude, longitude));
        NLog.e("LocationInit", aMapLocation.getRoad() + aMapLocation.getStreet() + aMapLocation.getPoiName() + latitude + "----" + longitude);


        addChooseMarker();
    }
}
 
Example #3
Source File: SessionAdapter.java    From LQRWeChat with MIT License 5 votes vote down vote up
@Override
public int getItemViewType(int position) {
    Message msg = mData.get(position);
    boolean isSend = msg.getMessageDirection() == Message.MessageDirection.SEND ? true : false;

    MessageContent msgContent = msg.getContent();
    if (msgContent instanceof TextMessage) {
        return isSend ? SEND_TEXT : RECEIVE_TEXT;
    }
    if (msgContent instanceof ImageMessage) {
        return isSend ? SEND_IMAGE : RECEIVE_IMAGE;
    }
    if (msgContent instanceof FileMessage) {
        FileMessage fileMessage = (FileMessage) msgContent;
        if (MediaFileUtils.isImageFileType(fileMessage.getName())) {
            return isSend ? SEND_STICKER : RECEIVE_STICKER;
        } else if (MediaFileUtils.isVideoFileType(fileMessage.getName())) {
            return isSend ? SEND_VIDEO : RECEIVE_VIDEO;
        }
    }
    if (msgContent instanceof LocationMessage) {
        return isSend ? SEND_LOCATION : RECEIVE_LOCATION;
    }
    if (msgContent instanceof GroupNotificationMessage) {
        return RECEIVE_NOTIFICATION;
    }
    if (msgContent instanceof VoiceMessage) {
        return isSend ? SEND_VOICE : RECEIVE_VOICE;
    }
    if (msgContent instanceof RedPacketMessage) {
        return isSend ? SEND_RED_PACKET : RECEIVE_RED_PACKET;
    }
    if (msgContent instanceof RecallNotificationMessage) {
        return RECALL_NOTIFICATION;
    }
    return UNDEFINE_MSG;
}
 
Example #4
Source File: PlaceLocationSelectActivity.java    From Fishing with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onRegeocodeSearched(RegeocodeResult regeocodeResult, int i) {
    address.setText(regeocodeResult.getRegeocodeAddress().getFormatAddress());
    mAddress = regeocodeResult.getRegeocodeAddress().getFormatAddress();
    mBriefAddress = regeocodeResult.getRegeocodeAddress().getTownship();
    Uri uri = Uri.parse("http://m.amap.com/navi").buildUpon()
            .appendQueryParameter("dest",LocationModel.getInstance().getCurLocation().getLatitude()+","+LocationModel.getInstance().getCurLocation().getLongitude())
            .appendQueryParameter("destName",mAddress)
            .appendQueryParameter("hideRouteIcon","1")
            .appendQueryParameter("key","474871845dfffa03a26cfcb0ab4fb4f1")
            .build();
    locationMessage = LocationMessage.obtain(LocationModel.getInstance().getCurLocation().getLatitude(),LocationModel.getInstance().getCurLocation().getLongitude(),
            mAddress, uri);
}