91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

高德導航功能模塊

發布時間:2020-08-01 16:21:03 來源:網絡 閱讀:720 作者:鷺明 欄目:開發技術


主要代碼:

public class MainActivity extends BaseActivity {


private EditText edit_end_lng;

private EditText edit_end_lat;

private EditText edi_star_Lat;

private EditText edi_star_Lng;

public static Double endLng = 0.0;

public static Double endLat = 0.0;

public static Double startLat = 0.0;

public static Double startLng = 0.0;

NaviLatLng mStartLatlng ;

NaviLatLng mEndLatlng ;


@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);

iniUi();

mAMapNaviView = (AMapNaviView) findViewById(R.id.navi_view);

mAMapNaviView.onCreate(savedInstanceState);

mAMapNaviView.setAMapNaviViewListener(this);

}

public void iniUi() 

{


edit_end_lat = (EditText) findViewById(R.id.edit_end_lat);

edit_end_lng = (EditText) findViewById(R.id.edit_end_lng);

edi_star_Lat = (EditText) findViewById(R.id.edi_star_Lat);

edi_star_Lng = (EditText) findViewById(R.id.edi_star_Lng);


}

public void btnSure(View v) 

{

String end_lat = edit_end_lat.getText().toString();

String end_lng = edit_end_lng.getText().toString();

String star_lat = edi_star_Lat.getText().toString();

String star_lng = edi_star_Lng.getText().toString();


if (end_lng != null) {

try {

endLng = Double.parseDouble(end_lng);

} catch (Exception e) {

}

}

if (end_lat != null) {

try {

endLat = Double.parseDouble(end_lat);

} catch (Exception e) {

}

}

if (star_lat != null) {

try {

startLat = Double.parseDouble(star_lat);

} catch (Exception e) {

}

}


if (star_lng != null) {

try {

startLng = Double.parseDouble(star_lng);

} catch (Exception e) {

}

}


Log.e("日志查看","endLng="+endLng );

Log.e("日志查看","endLat="+endLat );

Log.e("日志查看","startLat="+startLat);

Log.e("日志查看","startLng="+startLng );

mStartLatlng = new NaviLatLng(startLng,startLat);

mEndLatlng = new NaviLatLng(endLng,endLat);

//文本框中輸入正常的經緯度就可以導航成功,如下列所示:

//開始輸入:經度24.67, 緯度100.10

//結束輸入:經度25.80, 緯度118.34

// 設置模擬導航的行車速度

mAMapNavi.setEmulatorNaviSpeed(350);

sList.add(mStartLatlng);

eList.add(mEndLatlng);

onInitNaviSuccess();


}


}



public class BaseActivity extends Activity implements AMapNaviListener, AMapNaviViewListener {


    protected AMapNaviView mAMapNaviView;

    protected AMapNavi mAMapNavi;

    protected TTSController mTtsManager;

    protected final List<NaviLatLng> sList = new ArrayList<NaviLatLng>();

    protected final List<NaviLatLng> eList = new ArrayList<NaviLatLng>();

    protected List<NaviLatLng> mWayPointList;


    @Override

    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);

        requestWindowFeature(Window.FEATURE_NO_TITLE);


        //實例化語音引擎

        mTtsManager = TTSController.getInstance(getApplicationContext());

        mTtsManager.init();

        mTtsManager.startSpeaking();


        //

        mAMapNavi = AMapNavi.getInstance(getApplicationContext());

        mAMapNavi.addAMapNaviListener(this);

        mAMapNavi.addAMapNaviListener(mTtsManager);


      /*  設置模擬導航的行車速度

        mAMapNavi.setEmulatorNaviSpeed(350);

        sList.add(new MainActivity().mStartLatlng);

        eList.add(new MainActivity().mEndLatlng);

        sList.add(mStartLatlng);

        eList.add(mEndLatlng);*/

    }


    @Override

    protected void onResume() {

        super.onResume();

        mAMapNaviView.onResume();

    }


    @Override

    protected void onPause() {

        super.onPause();

        mAMapNaviView.onPause();


//        僅僅是停止你當前在說的這句話,一會到新的路口還是會再說的

        mTtsManager.stopSpeaking();

//

//        停止導航之后,會觸及底層stop,然后就不會再有回調了,但是訊飛當前還是沒有說完的半句話還是會說完

//        mAMapNavi.stopNavi();

    }


    @Override

    protected void onDestroy() {

        super.onDestroy();

        mAMapNaviView.onDestroy();

        //since 1.6.0 不再在naviview destroy的時候自動執行AMapNavi.stopNavi();請自行執行

        mAMapNavi.stopNavi();

        mAMapNavi.destroy();

        mTtsManager.destroy();

    }


    @Override

    public void onInitNaviFailure() {

        Toast.makeText(this, "init navi Failed", Toast.LENGTH_SHORT).show();

    }


    @Override

    public void onInitNaviSuccess() {

        /**

         * 方法:

         *   int strategy=mAMapNavi.strategyConvert(congestion, avoidhightspeed, cost, hightspeed, multipleroute);

         * 參數:

         * @congestion 躲避擁堵

         * @avoidhightspeed 不走高速

         * @cost 避免收費

         * @hightspeed 高速優先

         * @multipleroute 多路徑

         *

         * 說明:

         *      以上參數都是boolean類型,其中multipleroute參數表示是否多條路線,如果為true則此策略會算出多條路線。

         * 注意:

         *      不走高速與高速優先不能同時為true

         *      高速優先與避免收費不能同時為true

         */

        int strategy=0;

        try {

            strategy=mAMapNavi.strategyConvert(true, false, false, false, false);

        } catch (Exception e) {

            e.printStackTrace();

        }

        mAMapNavi.calculateDriveRoute(sList, eList, mWayPointList,strategy);

    }


    @Override

    public void onStartNavi(int type) {

    }


    @Override

    public void onTrafficStatusUpdate() {


    }


    @Override

    public void onLocationChange(AMapNaviLocation location) {


    }


    @Override

    public void onGetNavigationText(int type, String text) {


    }


    @Override

    public void onEndEmulatorNavi() {

    }


    @Override

    public void onArriveDestination() {

    }


    @Override

    public void onCalculateRouteSuccess() {

        mAMapNavi.startNavi(NaviType.EMULATOR);

    }


    @Override

    public void onCalculateRouteFailure(int errorInfo) {

    }


    @Override

    public void onReCalculateRouteForYaw() {


    }


    @Override

    public void onReCalculateRouteForTrafficJam() {


    }


    @Override

    public void onArrivedWayPoint(int wayID) {


    }


    @Override

    public void onGpsOpenStatus(boolean enabled) {

    }


    @Override

    public void onNaviSetting() {

    }


    @Override

    public void onNaviMapMode(int isLock) {


    }


    @Override

    public void onNaviCancel() {

        finish();

    }



    @Override

    public void onNaviTurnClick() {


    }


    @Override

    public void onNextRoadClick() {


    }



    @Override

    public void onScanViewButtonClick() {

    }


    @Deprecated

    @Override

    public void onNaviInfoUpdated(AMapNaviInfo naviInfo) {

    }


    @Override

    public void onNaviInfoUpdate(NaviInfo naviinfo) {

    }


    @Override

    public void OnUpdateTrafficFacility(TrafficFacilityInfo trafficFacilityInfo) {


    }


    @Override

    public void OnUpdateTrafficFacility(AMapNaviTrafficFacilityInfo aMapNaviTrafficFacilityInfo) {


    }


    @Override

    public void showCross(AMapNaviCross aMapNaviCross) {

    }


    @Override

    public void hideCross() {

    }


    @Override

    public void showLaneInfo(AMapLaneInfo[] laneInfos, byte[] laneBackgroundInfo, byte[] laneRecommendedInfo) {


    }


    @Override

    public void hideLaneInfo() {


    }


    @Override

    public void onCalculateMultipleRoutesSuccess(int[] ints) {


    }


    @Override

    public void notifyParallelRoad(int i) {


    }


    @Override

    public void OnUpdateTrafficFacility(AMapNaviTrafficFacilityInfo[] aMapNaviTrafficFacilityInfos) {


    }


    @Override

    public void updateAimlessModeStatistics(AimLessModeStat aimLessModeStat) {


    }



    @Override

    public void updateAimlessModeCongestionInfo(AimLessModeCongestionInfo aimLessModeCongestionInfo) {


    }



    @Override

    public void onLockMap(boolean isLock) {

    }


    @Override

    public void onNaviViewLoaded() {

        Log.d("wlx", "導航頁面加載成功");

        Log.d("wlx", "請不要使用AMapNaviView.getMap().setOnMapLoadedListener();會overwrite導航SDK內部畫線邏輯");

    }


    @Override

    public boolean onNaviBackClick() {

        return false;

    }



}



public class TTSController implements SynthesizerListener, AMapNaviListener {


    public static TTSController ttsManager;

    boolean isfinish = true;

    private Context mContext;

    // 合成對象.

    private SpeechSynthesizer mSpeechSynthesizer;

    /**

     * 用戶登錄回調監聽器.

     */

    private SpeechListener listener = new SpeechListener() {


        @Override

        public void onData(byte[] arg0) {

        }


        @Override

        public void onCompleted(SpeechError error) {

            if (error != null) {


            }

        }


        @Override

        public void onEvent(int arg0, Bundle arg1) {

        }

    };


    TTSController(Context context) {

        mContext = context;

    }


    public static TTSController getInstance(Context context) {

        if (ttsManager == null) {

            ttsManager = new TTSController(context);

        }

        return ttsManager;

    }


    public void init() {

        SpeechUser.getUser().login(mContext, null, null,

                "appid=" + mContext.getString(R.string.app_id), listener);

        // 初始化合成對象.

        mSpeechSynthesizer = SpeechSynthesizer.createSynthesizer(mContext);

        initSpeechSynthesizer();

    }


    /**

     * 使用SpeechSynthesizer合成語音,不彈出合成Dialog.

     *

     * @param

     */

    public void playText(String playText) {

        if (!isfinish) {

            return;

        }

        if (null == mSpeechSynthesizer) {

            // 創建合成對象.

            mSpeechSynthesizer = SpeechSynthesizer.createSynthesizer(mContext);

            initSpeechSynthesizer();

        }

        // 進行語音合成.

        mSpeechSynthesizer.startSpeaking(playText, this);


    }


    public void stopSpeaking() {

        if (mSpeechSynthesizer != null)

            mSpeechSynthesizer.stopSpeaking();

    }


    public void startSpeaking() {

        isfinish = true;

    }


    private void initSpeechSynthesizer() {

        // 設置發音人

        mSpeechSynthesizer.setParameter(SpeechConstant.VOICE_NAME,

                mContext.getString(R.string.preference_default_tts_role));

        // 設置語速

        mSpeechSynthesizer.setParameter(SpeechConstant.SPEED,

                "" + mContext.getString(R.string.preference_key_tts_speed));

        // 設置音量

        mSpeechSynthesizer.setParameter(SpeechConstant.VOLUME,

                "" + mContext.getString(R.string.preference_key_tts_volume));

        // 設置語調

        mSpeechSynthesizer.setParameter(SpeechConstant.PITCH,

                "" + mContext.getString(R.string.preference_key_tts_pitch));


    }


    @Override

    public void onBufferProgress(int arg0, int arg1, int arg2, String arg3) {



    }


    @Override

    public void onCompleted(SpeechError arg0) {


        isfinish = true;

    }


    @Override

    public void onSpeakBegin() {


        isfinish = false;


    }


    @Override

    public void onSpeakPaused() {



    }


    @Override

    public void onSpeakProgress(int arg0, int arg1, int arg2) {



    }


    @Override

    public void onSpeakResumed() {



    }


    public void destroy() {

        if (mSpeechSynthesizer != null) {

            mSpeechSynthesizer.stopSpeaking();

        }

    }


    @Override

    public void onArriveDestination() {


        this.playText("到達目的地");

    }


    @Override

    public void onArrivedWayPoint(int arg0) {


    }


    @Override

    public void onCalculateRouteFailure(int arg0) {

        this.playText("路徑計算失敗,請檢查網絡或輸入參數");

    }


    @Override

    public void onCalculateRouteSuccess() {

        String calculateResult = "路徑計算就緒";


        this.playText(calculateResult);

    }


    @Override

    public void onEndEmulatorNavi() {

        this.playText("導航結束");


    }


    @Override

    public void onGetNavigationText(int arg0, String arg1) {


        this.playText(arg1);

    }


    @Override

    public void onInitNaviFailure() {



    }


    @Override

    public void onInitNaviSuccess() {



    }


    @Override

    public void onLocationChange(AMapNaviLocation arg0) {



    }


    @Override

    public void onReCalculateRouteForTrafficJam() {


        this.playText("前方路線擁堵,路線重新規劃");

    }


    @Override

    public void onReCalculateRouteForYaw() {


        this.playText("您已偏航");

    }


    @Override

    public void onStartNavi(int arg0) {



    }


    @Override

    public void onTrafficStatusUpdate() {



    }


    @Override

    public void onGpsOpenStatus(boolean arg0) {



    }


    @Override

    public void onNaviInfoUpdated(AMapNaviInfo arg0) {



    }


    @Override

    public void onNaviInfoUpdate(NaviInfo arg0) {




    }


    @Override

    public void OnUpdateTrafficFacility(TrafficFacilityInfo trafficFacilityInfo) {


    }


    @Override

    public void OnUpdateTrafficFacility(AMapNaviTrafficFacilityInfo aMapNaviTrafficFacilityInfo) {


    }


    @Override

    public void showCross(AMapNaviCross aMapNaviCross) {


    }


    @Override

    public void hideCross() {


    }


    @Override

    public void showLaneInfo(AMapLaneInfo[] aMapLaneInfos, byte[] bytes, byte[] bytes1) {


    }


    @Override

    public void hideLaneInfo() {


    }


    @Override

    public void onCalculateMultipleRoutesSuccess(int[] ints) {


    }


    @Override

    public void notifyParallelRoad(int i) {


    }


    @Override

    public void OnUpdateTrafficFacility(AMapNaviTrafficFacilityInfo[] aMapNaviTrafficFacilityInfos) {


    }


    @Override

    public void updateAimlessModeStatistics(AimLessModeStat aimLessModeStat) {


    }



    @Override

    public void updateAimlessModeCongestionInfo(AimLessModeCongestionInfo aimLessModeCongestionInfo) {


    }

}



public class Utils {

    public static final String DAY_NIGHT_MODE = "daynightmode";

    public static final String DEVIATION = "deviationrecalculation";

    public static final String JAM = "jamrecalculation";

    public static final String TRAFFIC = "trafficbroadcast";

    public static final String CAMERA = "camerabroadcast";

    public static final String SCREEN = "screenon";

    public static final String THEME = "theme";

    public static final String ISEMULATOR = "isemulator";



    public static final String ACTIVITYINDEX = "activityindex";


    public static final int SIMPLEHUDNAVIE = 0;

    public static final int EMULATORNAVI = 1;

    public static final int SIMPLEGPSNAVI = 2;

    public static final int SIMPLEROUTENAVI = 3;



    public static final boolean DAY_MODE = false;

    public static final boolean NIGHT_MODE = true;

    public static final boolean YES_MODE = true;

    public static final boolean NO_MODE = false;

    public static final boolean OPEN_MODE = true;

    public static final boolean CLOSE_MODE = false;


}


向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

绥棱县| 琼海市| 东乌珠穆沁旗| 绥滨县| 霍城县| 黄大仙区| 河源市| 城口县| 南开区| 汶上县| 砀山县| 武平县| 高淳县| 定陶县| 苏州市| 兴城市| 集贤县| 新巴尔虎右旗| 卓尼县| 敖汉旗| 成安县| 十堰市| 兴山县| 司法| 九龙坡区| 无锡市| 民权县| 涟源市| 浠水县| 崇州市| 乌恰县| 肇东市| 托克托县| 周宁县| 垣曲县| 安康市| 永胜县| 宜兴市| 卓尼县| 龙里县| 航空|