diff --git a/OsmAnd/AndroidManifest.xml b/OsmAnd/AndroidManifest.xml index df5fa33179..f537dcda7f 100644 --- a/OsmAnd/AndroidManifest.xml +++ b/OsmAnd/AndroidManifest.xml @@ -5,14 +5,15 @@ android:versionName="1.0"> + android:label="@string/app_name" android:launchMode="standard"> - + + diff --git a/OsmAnd/res/layout/main.xml b/OsmAnd/res/layout/main.xml index 430d462896..3e5fc1b964 100644 --- a/OsmAnd/res/layout/main.xml +++ b/OsmAnd/res/layout/main.xml @@ -2,14 +2,11 @@ - + android:layout_height="fill_parent"> + - - - + android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom|right"> + diff --git a/OsmAnd/res/layout/settings.xml b/OsmAnd/res/layout/settings.xml new file mode 100644 index 0000000000..65371559de --- /dev/null +++ b/OsmAnd/res/layout/settings.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 99b9a14a9e..8664ba99af 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -1,5 +1,9 @@ + Settings + Show gps coordinates on map + Use internet to download missing tiles Hello World, StartActivity! OsmAnd + diff --git a/OsmAnd/src/com/osmand/MapActivity.java b/OsmAnd/src/com/osmand/MapActivity.java index 15348d63ee..7389e7344a 100644 --- a/OsmAnd/src/com/osmand/MapActivity.java +++ b/OsmAnd/src/com/osmand/MapActivity.java @@ -3,6 +3,7 @@ package com.osmand; import java.io.File; import android.app.Activity; +import android.content.Intent; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; @@ -11,6 +12,7 @@ import android.os.Environment; import android.view.View; import android.view.Window; import android.view.View.OnClickListener; +import android.widget.Button; import android.widget.ImageButton; import android.widget.ZoomControls; @@ -39,7 +41,7 @@ public class MapActivity extends Activity implements LocationListener, IMapLocat setContentView(R.layout.main); - mapView = (OsmandMapTileView) findViewById(R.id.View01); + mapView = (OsmandMapTileView) findViewById(R.id.MapView); mapView.setFileWithTiles(new File(Environment.getExternalStorageDirectory(), "osmand/tiles/")); mapView.addMapLocationListener(this); @@ -75,8 +77,18 @@ public class MapActivity extends Activity implements LocationListener, IMapLocat }); + Button goToSettings = (Button)findViewById(R.id.GoToSettingsButton); + goToSettings.setOnClickListener(new OnClickListener(){ + @Override + public void onClick(View v) { + final Intent settings = new Intent(MapActivity.this, SettingsActivity.class); + startActivity(settings); + } + + }); + + LocationManager service = (LocationManager) getSystemService(LOCATION_SERVICE); -// service.get service.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, 0, this); } diff --git a/OsmAnd/src/com/osmand/OsmandMapTileView.java b/OsmAnd/src/com/osmand/OsmandMapTileView.java index 51d7e85929..2326081261 100644 --- a/OsmAnd/src/com/osmand/OsmandMapTileView.java +++ b/OsmAnd/src/com/osmand/OsmandMapTileView.java @@ -34,6 +34,9 @@ public class OsmandMapTileView extends View implements IMapDownloaderCallback { protected final int emptyTileDivisor = DefaultLauncherConstants.MAP_divNonLoadedImage; protected final int maxImgCacheSize = 512; + protected int drawCoordinatesX = 0; + protected int drawCoordinatesY = 55; + protected static final Log log = LogFactory.getLog(OsmandMapTileView.class); /** * file or directory with tiles @@ -188,7 +191,8 @@ public class OsmandMapTileView extends View implements IMapDownloaderCallback { canvas.drawCircle(getWidth()/2, getHeight()/2, 3, paintBlack); canvas.drawCircle(getWidth()/2, getHeight()/2, 6, paintBlack); if (DefaultLauncherConstants.showGPSCoordinates) { - canvas.drawText(MessageFormat.format("Lat : {0}, lon : {1}, zoom : {2}", latitude, longitude, zoom), 0, 15, paintBlack); + canvas.drawText(MessageFormat.format("Lat : {0}, lon : {1}, zoom : {2}", latitude, longitude, zoom), + drawCoordinatesX, drawCoordinatesY, paintBlack); } } diff --git a/OsmAnd/src/com/osmand/SettingsActivity.java b/OsmAnd/src/com/osmand/SettingsActivity.java new file mode 100644 index 0000000000..64565eafc0 --- /dev/null +++ b/OsmAnd/src/com/osmand/SettingsActivity.java @@ -0,0 +1,36 @@ +package com.osmand; + +import android.app.Activity; +import android.os.Bundle; +import android.view.View; +import android.view.View.OnClickListener; +import android.widget.CheckBox; + +public class SettingsActivity extends Activity { + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.settings); + + final CheckBox useInternet = (CheckBox)findViewById(R.id.use_internet_to_download_tile); + useInternet.setOnClickListener(new OnClickListener(){ + @Override + public void onClick(View v) { + DefaultLauncherConstants.loadMissingImages = useInternet.isChecked(); + } + + }); + useInternet.setChecked(DefaultLauncherConstants.loadMissingImages); + + final CheckBox showGPSText = (CheckBox)findViewById(R.id.show_gps_coordinates_text); + showGPSText.setOnClickListener(new OnClickListener(){ + @Override + public void onClick(View v) { + DefaultLauncherConstants.showGPSCoordinates = showGPSText.isChecked(); + } + + }); + showGPSText.setChecked(DefaultLauncherConstants.showGPSCoordinates); + } + +}