当前位置: 首页>>代码示例>>Java>>正文


Java LocationServices.FusedLocationApi方法代码示例

本文整理汇总了Java中com.mapzen.android.lost.api.LocationServices.FusedLocationApi方法的典型用法代码示例。如果您正苦于以下问题:Java LocationServices.FusedLocationApi方法的具体用法?Java LocationServices.FusedLocationApi怎么用?Java LocationServices.FusedLocationApi使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.mapzen.android.lost.api.LocationServices的用法示例。


在下文中一共展示了LocationServices.FusedLocationApi方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onDestroy

import com.mapzen.android.lost.api.LocationServices; //导入方法依赖的package包/类
@Override
public void onDestroy() {
    app.activateMoveMapToLocation();
    teardownLinedrawing();
    markReadyForUpload();
    mapController.clearLines();
    act.updateView();

    bus.unregister(this);
    showLocateButton();
    if (LocationServices.FusedLocationApi != null) {
        LocationServices.FusedLocationApi.setMockMode(false);
    }
    super.onDestroy();
}
 
开发者ID:mapzen,项目名称:open,代码行数:16,代码来源:RouteFragment.java

示例2: setup

import com.mapzen.android.lost.api.LocationServices; //导入方法依赖的package包/类
@Before
public void setup() {
    application = (MapzenApplication) Robolectric.application;
    application.inject(this);
    LocationServices.FusedLocationApi = null;
    mapController.setActivity(TestHelper.initBaseActivity());
    listener = new MapzenLocation.Listener(application);
}
 
开发者ID:mapzen,项目名称:open,代码行数:9,代码来源:MapzenLocationTest.java

示例3: shouldSetDefaultLocationUpdateInterval

import com.mapzen.android.lost.api.LocationServices; //导入方法依赖的package包/类
@Test
public void shouldSetDefaultLocationUpdateInterval() throws Exception {
    FusedLocationProviderApi api = Mockito.mock(FusedLocationProviderApi.class);
    LocationServices.FusedLocationApi = api;
    ArgumentCaptor<LocationRequest> argument = ArgumentCaptor.forClass(LocationRequest.class);
    onLocationServicesConnected(mapController, api, application);
    verify(api).requestLocationUpdates(argument.capture(), any(LocationListener.class));
    assertThat(argument.getValue().getInterval()).isEqualTo(1000);
}
 
开发者ID:mapzen,项目名称:open,代码行数:10,代码来源:MapzenLocationTest.java

示例4: shouldSetCustomLocationUpdateInterval

import com.mapzen.android.lost.api.LocationServices; //导入方法依赖的package包/类
@Test
public void shouldSetCustomLocationUpdateInterval() throws Exception {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(application);
    SharedPreferences.Editor editor = prefs.edit();
    editor.putInt(application.getString(R.string.settings_location_update_interval_key), 2000);
    editor.commit();

    FusedLocationProviderApi api = Mockito.mock(FusedLocationProviderApi.class);
    LocationServices.FusedLocationApi = api;
    ArgumentCaptor<LocationRequest> argument = ArgumentCaptor.forClass(LocationRequest.class);
    onLocationServicesConnected(mapController, api, application);
    verify(api).requestLocationUpdates(argument.capture(), any(LocationListener.class));
    assertThat(argument.getValue().getInterval()).isEqualTo(2000);
}
 
开发者ID:mapzen,项目名称:open,代码行数:15,代码来源:MapzenLocationTest.java

示例5: onLocationServicesConnected_shouldSetPriority

import com.mapzen.android.lost.api.LocationServices; //导入方法依赖的package包/类
@Test
public void onLocationServicesConnected_shouldSetPriority() throws Exception {
    FusedLocationProviderApi api = Mockito.mock(FusedLocationProviderApi.class);
    LocationServices.FusedLocationApi = api;
    ArgumentCaptor<LocationRequest> argument = ArgumentCaptor.forClass(LocationRequest.class);
    onLocationServicesConnected(mapController, api, application);
    verify(api).requestLocationUpdates(argument.capture(), any(LocationListener.class));
    assertThat(argument.getValue().getPriority()).isEqualTo(PRIORITY_HIGH_ACCURACY);
}
 
开发者ID:mapzen,项目名称:open,代码行数:10,代码来源:MapzenLocationTest.java

示例6: onCreateView

import com.mapzen.android.lost.api.LocationServices; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.route_widget, container, false);
    ButterKnife.inject(this, rootView);
    fragment = this;
    adapter = new RouteAdapter(act, instructions, fragment);
    adapter.setDestinationName(simpleFeature.getProperty(TEXT));
    TextView destinationName = (TextView) rootView.findViewById(R.id.destination_name);
    destinationName.setText(getString(R.string.routing_to_text) + simpleFeature
            .getProperty(TEXT));
    if (route != null) {
        distanceToDestination.setDistance(route.getTotalDistance());
    }
    pager.setAdapter(adapter);
    pager.setOnPageChangeListener(this);
    adapter.notifyDataSetChanged();
    currentXCor = mapFragment.getMap().getMapPosition().getX();
    initSpeakerbox();
    initNotificationCreator();
    pager.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            turnAutoPageOff();
            return false;
        }
    });
    initDebugView(rootView);
    initSlideLayout(rootView);
    setMapOnTouchListener();

    res = act.getResources();
    prefs = getDefaultSharedPreferences(act);

    if (LocationServices.FusedLocationApi != null) {
        if (prefs.getBoolean(getString(R.string.settings_mock_gpx_key), false)) {
            final String key = getString(R.string.settings_mock_gpx_filename_key);
            final String defaultFile =
                    getString(R.string.settings_mock_gpx_filename_default_value);
            final String filename = prefs.getString(key, defaultFile);
            final File file = new File(Environment.getExternalStorageDirectory(),
                    filename);
            LocationServices.FusedLocationApi.setMockMode(true);
            LocationServices.FusedLocationApi.setMockTrace(file);
        } else {
            LocationServices.FusedLocationApi.setMockMode(false);
        }
    }

    hideLocateButtonAndAttribution();
    return rootView;
}
 
开发者ID:mapzen,项目名称:open,代码行数:53,代码来源:RouteFragment.java

示例7: setTestLocationClient

import com.mapzen.android.lost.api.LocationServices; //导入方法依赖的package包/类
private void setTestLocationClient() {
    LocationServices.FusedLocationApi = new TestFusedLocationProviderApiImpl(application);
}
 
开发者ID:mapzen,项目名称:open,代码行数:4,代码来源:RouteFragmentTest.java


注:本文中的com.mapzen.android.lost.api.LocationServices.FusedLocationApi方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。