use of io.realm.RealmModel in project open-event-android by fossasia.
the class OSMapFragment method populateMap.
private void populateMap() {
if (!mayRequestStorageForOfflineMap())
return;
final MapView mapView = (MapView) rootView.findViewById(R.id.mapview);
final ZoomControls zoomControls = (ZoomControls) rootView.findViewById(R.id.zoomControls);
Resources resources = getContext().getResources();
int resourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android");
if (resourceId > 0) {
zoomControls.setPadding(0, 0, 0, resources.getDimensionPixelSize(resourceId) + 4);
}
mapView.setBuiltInZoomControls(false);
mapView.setMultiTouchControls(true);
event = realmRepo.getEvent();
event.addChangeListener(new RealmChangeListener<RealmModel>() {
@Override
public void onChange(RealmModel realmModel) {
showEvent();
}
});
GeoPoint geoPoint = new GeoPoint(getDestinationLatitude(), getDestinationLongitude());
mapView.getController().setCenter(geoPoint);
mapView.getController().setZoom(17);
mapView.setMaxZoomLevel(20);
mapView.setMinZoomLevel(3);
OverlayItem position = new OverlayItem(getDestinationName(), "Location", geoPoint);
zoomControls.setOnZoomInClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mapView.getController().zoomIn();
}
});
zoomControls.setOnZoomOutClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mapView.getController().zoomOut();
}
});
ArrayList<OverlayItem> items = new ArrayList<>();
items.add(position);
mapView.getOverlays().add(new ItemizedIconOverlay<>(items, new ItemizedIconOverlay.OnItemGestureListener<OverlayItem>() {
@Override
public boolean onItemSingleTapUp(int index, OverlayItem item) {
return false;
}
@Override
public boolean onItemLongPress(int index, OverlayItem item) {
return false;
}
}, new DefaultResourceProxyImpl(getActivity())));
mapView.invalidate();
}
use of io.realm.RealmModel in project realm-java by realm.
the class NativeRealmAnyCollection method newRealmModelCollection.
public static NativeRealmAnyCollection newRealmModelCollection(Collection<? extends RealmModel> collection) {
long[] objectValues = new long[collection.size()];
boolean[] notNull = new boolean[collection.size()];
int i = 0;
for (RealmModel model : collection) {
if (model != null) {
RealmObjectProxy proxy = (RealmObjectProxy) model;
objectValues[i] = ((UncheckedRow) proxy.realmGet$proxyState().getRow$realm()).getNativePtr();
notNull[i] = true;
}
i++;
}
return new NativeRealmAnyCollection(nativeCreateObjectCollection(objectValues, notNull));
}
Aggregations