本文整理汇总了Java中com.google.samples.apps.iosched.util.MapUtils类的典型用法代码示例。如果您正苦于以下问题:Java MapUtils类的具体用法?Java MapUtils怎么用?Java MapUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MapUtils类属于com.google.samples.apps.iosched.util包,在下文中一共展示了MapUtils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onOverlayLoaderComplete
import com.google.samples.apps.iosched.util.MapUtils; //导入依赖的package包/类
private void onOverlayLoaderComplete(Cursor cursor) {
if (cursor != null && cursor.getCount() > 0) {
cursor.moveToFirst();
while (!cursor.isAfterLast()) {
final int floor = cursor.getInt(OverlayQuery.TILE_FLOOR);
final String file = cursor.getString(OverlayQuery.TILE_FILE);
File f = MapUtils.getTileFile(getActivity().getApplicationContext(), file);
if (f != null) {
addTileProvider(floor, f);
}
cursor.moveToNext();
}
}
mOverlaysLoaded = true;
enableMapElements();
}
示例2: deselectActiveMarker
import com.google.samples.apps.iosched.util.MapUtils; //导入依赖的package包/类
private void deselectActiveMarker() {
if (mActiveMarker == null) {
return;
}
final String typeString = mActiveMarker.getProperty("type");
final int type = MapUtils.detectMarkerType(typeString);
GeoJsonPointStyle style = mActiveMarker.getPointStyle();
if (type == MarkerModel.TYPE_ICON) {
// For icon markers, use the Maputils to load the original icon again.
final Bitmap iconBitmap = MapUtils.getIconMarkerBitmap(getContext(), typeString, false);
if (iconBitmap != null) {
style.setIcon(BitmapDescriptorFactory.fromBitmap(iconBitmap));
}
} else if (MapUtils.useActiveMarker(type)) {
// Change the icon back if the generic active marker was used.
style.setIcon(ICON_NORMAL);
}
mActiveMarker.setPointStyle(style);
mActiveMarker = null;
}
示例3: selectActiveMarker
import com.google.samples.apps.iosched.util.MapUtils; //导入依赖的package包/类
private void selectActiveMarker(GeoJsonFeature feature) {
if (mActiveMarker == feature || feature == null) {
return;
}
final String typeString = feature.getProperty("type");
final int type = MapUtils.detectMarkerType(typeString);
mActiveMarker = feature;
GeoJsonPointStyle style = mActiveMarker.getPointStyle();
if (type == MarkerModel.TYPE_ICON) {
// For TYPE_ICON markers, use the MapUtils to generate a tinted icon.
final Bitmap iconBitmap = MapUtils.getIconMarkerBitmap(getContext(), typeString, true);
if (iconBitmap != null) {
style.setIcon(BitmapDescriptorFactory.fromBitmap(iconBitmap));
}
} else if (MapUtils.useActiveMarker(type)) {
// Replace the icon of this feature with the generic active marker.
style.setIcon(ICON_ACTIVE);
}
mActiveMarker.setPointStyle(style);
}
示例4: onMarkersLoaded
import com.google.samples.apps.iosched.util.MapUtils; //导入依赖的package包/类
private void onMarkersLoaded(JSONObject data) {
if (data != null) {
// Parse the JSONObject as GeoJson and add it to the map
mGeoJsonLayer = MapUtils.processGeoJson(getContext(), mMap, data);
if (mGeoJsonLayer == null) {
return;
}
mGeoJsonLayer.addLayerToMap();
for (GeoJsonFeature feature : mGeoJsonLayer.getFeatures()) {
if (feature == null) {
break;
}
mMarkers.put(feature.getProperty("id"), feature);
}
}
// Highlight a room if there is a pending id.
highlightRoom(mHighlightedRoomId);
mHighlightedRoomId = null;
}
示例5: showSessionSubtitle
import com.google.samples.apps.iosched.util.MapUtils; //导入依赖的package包/类
private void showSessionSubtitle(String roomTitle, int roomType, Cursor sessions,
String iconType) {
if (sessions == null || sessions.isAfterLast()) {
onSessionLoadingFailed(roomTitle, roomType, iconType);
return;
}
sessions.moveToFirst();
final String title = roomTitle;
final String subtitle = sessions.getString(SingleSessionLoader.Query.SESSION_ABSTRACT);
setHeader(MapUtils.getDrawableForIconType(getContext(), iconType), title, subtitle);
mList.setVisibility(GONE);
onRoomSubtitleLoaded(title, roomType, subtitle, iconType);
}
示例6: setupMap
import com.google.samples.apps.iosched.util.MapUtils; //导入依赖的package包/类
private void setupMap(boolean resetCamera) {
// Add a Marker for Moscone
mMosconeMaker = mMap
.addMarker(MapUtils.createMosconeMarker(MOSCONE).visible(false));
if (resetCamera) {
// Move camera directly to Moscone
centerOnMoscone(false);
}
LOGD(TAG, "Map setup complete.");
}
示例7: showSessionList
import com.google.samples.apps.iosched.util.MapUtils; //导入依赖的package包/类
private void showSessionList(String roomTitle, int roomType, Cursor sessions) {
if (sessions == null || sessions.isAfterLast()) {
onSessionLoadingFailed(roomTitle, roomType);
return;
}
onSessionsLoaded(roomTitle, roomType, sessions);
mList.setAdapter(new SessionAdapter(getActivity(), sessions, 0,
MapUtils.hasInfoSessionListIcons(roomType)));
}
示例8: showSessionSubtitle
import com.google.samples.apps.iosched.util.MapUtils; //导入依赖的package包/类
private void showSessionSubtitle(String roomTitle, int roomType, Cursor sessions) {
if (sessions == null || sessions.isAfterLast()) {
onSessionLoadingFailed(roomTitle, roomType);
return;
}
sessions.moveToFirst();
final String title = roomTitle;
final String subtitle = sessions.getString(SingleSessionLoader.Query.SESSION_ABSTRACT);
setHeader(MapUtils.getRoomIcon(roomType), title, subtitle);
mList.setVisibility(View.GONE);
onRoomSubtitleLoaded(title, roomType, subtitle);
}
示例9: loadSessions
import com.google.samples.apps.iosched.util.MapUtils; //导入依赖的package包/类
/**
* Prepares and starts a SessionLoader for the specified query token.
*/
private void loadSessions(String roomId, String roomTitle, int roomType, int queryToken){
setHeader(MapUtils.getRoomIcon(roomType), roomTitle, null);
onSessionListLoading(roomId, roomTitle);
// Load the following sessions for this room
LoaderManager lm = getLoaderManager();
Bundle args = new Bundle();
args.putString(QUERY_ARG_ROOMID, roomId);
args.putString(QUERY_ARG_ROOMTITLE, roomTitle);
args.putInt(QUERY_ARG_ROOMTYPE, roomType);
lm.restartLoader(queryToken, args, this);
}
示例10: setupMap
import com.google.samples.apps.iosched.util.MapUtils; //导入依赖的package包/类
private void setupMap(boolean resetCamera) {
mInfoAdapter = new MapInfoWindowAdapter(LayoutInflater.from(getActivity()), getResources(),
mMarkers);
mMap = getMap();
// Add a Marker for Moscone
mMosconeMaker = mMap.addMarker(MapUtils.createMosconeMarker(mIconGenerator,
MOSCONE, getActivity()).visible(false));
mMap.setOnMarkerClickListener(this);
mMap.setOnInfoWindowClickListener(this);
mMap.setOnIndoorStateChangeListener(this);
mMap.setOnMapLoadedCallback(this);
mMap.setInfoWindowAdapter(mInfoAdapter);
if (resetCamera) {
// Move camera directly to Moscone
centerOnMoscone(false);
}
mMap.setIndoorEnabled(false);
mMap.getUiSettings().setZoomControlsEnabled(false);
mMap.setMyLocationEnabled(false);
Bundle data = getArguments();
if (data != null && data.containsKey(BaseMapActivity.EXTRA_ROOM)) {
mHighlightedRoom = data.getString(BaseMapActivity.EXTRA_ROOM);
}
LOGD(TAG, "Map setup complete.");
}
示例11: onStop
import com.google.samples.apps.iosched.util.MapUtils; //导入依赖的package包/类
@Override
public void onStop() {
super.onStop();
closeTileCache();
MapUtils.clearDiskCache(getActivity());
}
示例12: selectMarker
import com.google.samples.apps.iosched.util.MapUtils; //导入依赖的package包/类
private void selectMarker(GeoJsonFeature feature) {
if (feature == null) {
mCallbacks.onInfoHide();
return;
}
String type = feature.getProperty("type");
int markerType = MapUtils.detectMarkerType(type);
String id = feature.getProperty("id");
String title = feature.getProperty("title");
String subtitle = feature.getProperty("description");
if (MapUtils.hasInfoTitleOnly(markerType)) {
// Show a basic info window with a title only
mCallbacks.onInfoShowTitle(title, subtitle, markerType, type);
selectActiveMarker(feature);
} else if (MapUtils.hasInfoSessionList(markerType) || MapUtils.hasInfoSessionListIcons(markerType)) {
// Type has sessions to display
mCallbacks.onInfoShowSessionList(id, title, markerType, type);
selectActiveMarker(feature);
} else if (MapUtils.hasInfoFirstDescriptionOnly(markerType)) {
// Display the description of the first session only
mCallbacks.onInfoShowFirstSessionTitle(id, title, markerType, type);
selectActiveMarker(feature);
} else {
// Hide the bottom sheet for unknown markers
mCallbacks.onInfoHide();
}
}
示例13: showSessionList
import com.google.samples.apps.iosched.util.MapUtils; //导入依赖的package包/类
private void showSessionList(String roomTitle, int roomType, Cursor sessions, String iconType) {
if (sessions == null || sessions.isAfterLast()) {
onSessionLoadingFailed(roomTitle, roomType, iconType);
return;
}
onSessionsLoaded(roomTitle, roomType, sessions, iconType);
mList.setAdapter(new SessionAdapter(getActivity(), sessions,
MapUtils.hasInfoSessionListIcons(roomType), mOnClickListener));
}
示例14: loadSessions
import com.google.samples.apps.iosched.util.MapUtils; //导入依赖的package包/类
/**
* Prepares and starts a SessionLoader for the specified query token.
*/
private void loadSessions(String roomId, String roomTitle, int roomType, int queryToken,
String iconType){
setHeader(MapUtils.getDrawableForIconType(getContext(), iconType), roomTitle, null);
onSessionListLoading(roomId, roomTitle);
// Load the following sessions for this room
LoaderManager lm = getLoaderManager();
Bundle args = new Bundle();
args.putString(QUERY_ARG_ROOMID, roomId);
args.putString(QUERY_ARG_ROOMTITLE, roomTitle);
args.putInt(QUERY_ARG_ROOMTYPE, roomType);
args.putString(QUERY_ARG_ICONTYPE, iconType);
lm.restartLoader(queryToken, args, this);
}
示例15: onMarkerClick
import com.google.samples.apps.iosched.util.MapUtils; //导入依赖的package包/类
@Override
public boolean onMarkerClick(Marker marker) {
final String title = marker.getTitle();
final MarkerModel model = mMarkers.get(title);
// Log clicks on all markers (regardless of type)
// ANALYTICS EVENT: Click on marker on the map.
// Contains: Marker ID (for example room UUID)
AnalyticsHelper.sendEvent("Map", "markerclick", title);
deselectActiveMarker();
// The Moscone marker can be compared directly.
// For all other markers the model needs to be looked up first.
if (marker.equals(mMosconeMaker)) {
// Return camera to Moscone
LOGD(TAG, "Clicked on Moscone marker, return to initial display.");
centerOnMoscone(true);
} else if (model != null && MapUtils.hasInfoTitleOnly(model.type)) {
// Show a basic info window with a title only
mCallbacks.onInfoShowTitle(model.label, model.type);
selectActiveMarker(marker);
} else if (model != null && MapUtils.hasInfoSessionList(model.type)) {
// Type has sessions to display
mCallbacks.onInfoShowSessionlist(model.id, model.label, model.type);
selectActiveMarker(marker);
} else if (model != null && MapUtils.hasInfoFirstDescriptionOnly(model.type)) {
// Display the description of the first session only
mCallbacks.onInfoShowFirstSessionTitle(model.id, model.label, model.type);
selectActiveMarker(marker);
} else {
// Hide the bottom sheet for unknown markers
mCallbacks.onInfoHide();
}
return true;
}