List of usage examples for android.widget ZoomControls setOnZoomInClickListener
public void setOnZoomInClickListener(OnClickListener listener)
From source file:pl.itiner.nutiteq.NutiteqMap.java
private void setupZoom() { ZoomControls zoomControls = (ZoomControls) findViewById(R.id.zoomcontrols); zoomControls.setOnZoomInClickListener(new View.OnClickListener() { public void onClick(final View v) { mapComponent.zoomIn();/* w ww . j av a 2s . com*/ } }); zoomControls.setOnZoomOutClickListener(new View.OnClickListener() { public void onClick(final View v) { mapComponent.zoomOut(); } }); }
From source file:gr.scify.newsum.ui.SearchViewActivity.java
private void initZoomControls() { // Add zoom controls final TextView tx = (TextView) findViewById(R.id.textView1); // tx.setMovementMethod(LinkMovementMethod.getInstance()); final float minm = tx.getTextSize(); final float maxm = (minm + 24); ZoomControls zoom = (ZoomControls) findViewById(R.id.zoomControls1); zoom.setOnZoomInClickListener(new OnClickListener() { @Override//from w w w.ja v a 2 s . c om public void onClick(View v) { if (tx.getTextSize() < maxm) { tx.setTextSize(TypedValue.COMPLEX_UNIT_PX, tx.getTextSize() + 2); SharedPreferences textsize = getSharedPreferences("textS", 0); SharedPreferences.Editor editor = textsize.edit(); editor.putFloat("size", tx.getTextSize()); editor.commit(); } } }); zoom.setOnZoomOutClickListener(new OnClickListener() {// to the default // size @Override public void onClick(View v) { if (tx.getTextSize() > minm) tx.setTextSize(TypedValue.COMPLEX_UNIT_PX, tx.getTextSize() - 2); SharedPreferences textsize = getSharedPreferences("textS", 0); SharedPreferences.Editor editor = textsize.edit(); editor.putFloat("size", tx.getTextSize()); editor.commit(); } }); }
From source file:gr.scify.newsum.ui.ViewActivity.java
private void initZoomControls() { final TextView tx = (TextView) findViewById(R.id.textView1); final float minm = tx.getTextSize(); final float maxm = (minm + 24); // Add zoom controls ZoomControls zoom = (ZoomControls) findViewById(R.id.zoomControls1); zoom.setOnZoomInClickListener(new OnClickListener() { @Override// w w w . ja v a 2 s. co m public void onClick(View v) { if (tx.getTextSize() < maxm) { tx.setTextSize(TypedValue.COMPLEX_UNIT_PX, tx.getTextSize() + 2); SharedPreferences textsize = getSharedPreferences("textS", 0); SharedPreferences.Editor editor = textsize.edit(); editor.putFloat("size", tx.getTextSize()); editor.commit(); } } }); zoom.setOnZoomOutClickListener(new OnClickListener() {// to the default // size @Override public void onClick(View v) { if (tx.getTextSize() > minm) tx.setTextSize(TypedValue.COMPLEX_UNIT_PX, tx.getTextSize() - 2); SharedPreferences textsize = getSharedPreferences("textS", 0); SharedPreferences.Editor editor = textsize.edit(); editor.putFloat("size", tx.getTextSize()); editor.commit(); } }); }
From source file:org.smap.smapTask.android.activities.MainMapsActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main_map);//from w ww. jav a 2 s . co m onRetainCalled = false; mapComponent = new BasicMapComponent("ef0d3930a7b6c95bd2b32ed45989c61f507eb65ee43283.04602330", new AppContext(this), 1, 1, new WgsPoint(144.959, -37.818), 10); mapComponent.setMap(OpenStreetMap.MAPNIK); final MemoryCache memoryCache = new MemoryCache(10 * 1024 * 1024); final File cacheDir = new File("/sdcard/maps_lib_cache"); if (!cacheDir.exists()) { cacheDir.mkdir(); } final AndroidFileSystemCache fileSystemCache = new AndroidFileSystemCache(this, "network_cache", cacheDir, 10 * 1024 * 1024); // mapComponent.setNetworkCache(new CachingChain(new Cache[] { memoryCache, fileSystemCache })); mapComponent.setNetworkCache(fileSystemCache); storedMap = new StoredMap("x", "/sdcard/maps_lib_cache", true); final Image missing = Image.createImage(storedMap.getTileSize(), storedMap.getTileSize()); final Graphics graphics = missing.getGraphics(); graphics.setColor(0xFFCCCECC); graphics.fillRect(0, 0, storedMap.getTileSize(), storedMap.getTileSize()); storedMap.setMissingTileImage(missing); FileSystem fs = new JSR75FileSystem(); mapComponent.setFileSystem(fs); mapComponent.setErrorListener(new MyErrorListener()); mapComponent.setPanningStrategy(new ThreadDrivenPanning()); mapComponent.startMapping(); mapComponent.looseFocusOnDrag(true); // Define the location marker icon = BitmapFactory.decodeResource(getResources(), R.drawable.user_marker); pMark = new PlaceIcon(Image.createImage(icon), icon.getWidth() / 2, icon.getHeight()); // Define the completed task actual location marker taskDoneIcon = BitmapFactory.decodeResource(getResources(), R.drawable.task_done_marker); pMarkDone = new PlaceIcon(Image.createImage(taskDoneIcon), icon.getWidth() / 2, icon.getHeight()); // get the mapview that was defined in main.xml mMapView = (MapView) findViewById(R.id.mapview); //registerForContextMenu(mMapView); // mapview requires a mapcomponent mMapView.setMapComponent(mapComponent); mapComponent.setOnMapElementListener(this); mMapView.setFocusable(true); ZoomControls zoomControls = (ZoomControls) findViewById(R.id.zoomcontrols); // set zoomcontrols listeners to enable zooming zoomControls.setOnZoomInClickListener(new View.OnClickListener() { public void onClick(final View v) { mapComponent.zoomIn(); } }); zoomControls.setOnZoomOutClickListener(new View.OnClickListener() { public void onClick(final View v) { mapComponent.zoomOut(); } }); /* * Add a location listener */ locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); locationListener = new LocationListener() { @Override public void onLocationChanged(Location location) { if (userPlace != null) { mapComponent.removePlace(userPlace); } // TODO check for accuracy, save previous location WgsPoint point = new WgsPoint(location.getLongitude(), location.getLatitude()); userPlace = new Place(0, new PlaceLabel("Location"), pMark, point); mapComponent.addPlace(userPlace); } @Override public void onProviderDisabled(String arg0) { } @Override public void onProviderEnabled(String provider) { } @Override public void onStatusChanged(String provider, int status, Bundle extras) { } }; mapComponent.setMiddlePoint(new WgsPoint(144.95987, -37.81819)); mapComponent.setSmoothZoom(true); }