fix layout problems

git-svn-id: https://osmand.googlecode.com/svn/trunk@142 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8
This commit is contained in:
Victor Shcherb 2010-06-07 18:00:37 +00:00
parent 12c5ddb719
commit 065289abf8
5 changed files with 71 additions and 30 deletions

View file

@ -4,9 +4,9 @@
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent"> android:layout_height="fill_parent">
<com.osmand.views.OsmandMapTileView android:id="@+id/MapView" android:layout_width="fill_parent" android:layout_height="fill_parent"></com.osmand.views.OsmandMapTileView> <com.osmand.views.OsmandMapTileView android:id="@+id/MapView" android:layout_width="fill_parent" android:layout_height="fill_parent"></com.osmand.views.OsmandMapTileView>
<com.osmand.views.OsmZoomControls android:id="@+id/ZoomControls"
android:layout_width="100dp" android:layout_height="wrap_content" android:layout_gravity="bottom|right">></com.osmand.views.OsmZoomControls >
<ZoomControls android:id="@+id/ZoomControls01"
android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom|right"></ZoomControls>
<ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom|left" android:id="@+id/BackToMenu" android:background="@drawable/back_menu"></ImageButton> <ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom|left" android:id="@+id/BackToMenu" android:background="@drawable/back_menu"></ImageButton>
<ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="top|right" android:id="@+id/BackToLocation" android:background="@drawable/back_location"></ImageButton> <ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="top|right" android:id="@+id/BackToLocation" android:background="@drawable/back_location"></ImageButton>

View file

@ -1,44 +1,55 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:background="@drawable/background_rot"> android:layout_height="fill_parent" android:background="@drawable/background_rot">
<TableLayout android:layout_gravity="center"
<Button android:layout_height="45dp" android:layout_gravity="center" android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TableRow>
<Button
android:id="@+id/MapButton" android:id="@+id/MapButton"
android:text="@string/map_Button" android:text="@string/map_Button"
android:background="@drawable/btn_orange" android:background="@drawable/btn_orange"
android:textColor="#FFFFFF" android:textColor="#FFFFFF"
android:textStyle="bold" android:textStyle="bold"
android:drawableLeft="@drawable/map" android:layout_width="180dip"
android:layout_width="300dp" android:layout_marginTop="10dp"></Button> android:layout_height="70dip"
android:drawableLeft="@drawable/map"/>
<Button
<Button android:layout_height="45dp" android:layout_gravity="center"
android:id="@+id/SearchButton" android:id="@+id/SearchButton"
android:text="@string/search_button" android:text="@string/search_button"
android:background="@drawable/btn_orange" android:background="@drawable/btn_orange"
android:textColor="#FFFFFF" android:textColor="#FFFFFF"
android:textStyle="bold" android:textStyle="bold"
android:drawableLeft="@drawable/find" android:layout_width="180dip"
android:layout_width="300dp" android:layout_marginTop="10dp"></Button> android:layout_height="70dip"
<Button android:layout_height="45dp" android:layout_gravity="center" android:drawableLeft="@drawable/find"/>
</TableRow>
<TableRow>
<Button
android:id="@+id/FavoritesButton" android:id="@+id/FavoritesButton"
android:text="@string/favorites_Button" android:text="@string/favorites_Button"
android:background="@drawable/btn_orange" android:background="@drawable/btn_orange"
android:textColor="#FFFFFF" android:textColor="#FFFFFF"
android:textStyle="bold" android:textStyle="bold"
android:drawableLeft="@drawable/favorites" android:layout_width="180dip"
android:layout_width="300dp" android:layout_marginTop="10dp"></Button> android:layout_height="70dip"
<Button android:layout_height="45dp" android:layout_gravity="center" android:drawableLeft="@drawable/favorites"/>
<Button
android:id="@+id/SettingsButton" android:id="@+id/SettingsButton"
android:text="@string/settings_Button" android:text="@string/settings_Button"
android:background="@drawable/btn_orange" android:background="@drawable/btn_orange"
android:textColor="#FFFFFF" android:textColor="#FFFFFF"
android:textStyle="bold" android:textStyle="bold"
android:drawableLeft="@drawable/settings" android:layout_width="180dip"
android:layout_width="300dp" android:layout_marginTop="10dp"></Button> android:layout_height="70dip"
<FrameLayout android:id="@+id/FrameLayout01" android:drawableLeft="@drawable/settings"/>
</TableRow>
</TableLayout>
<FrameLayout android:id="@+id/FrameLayout"
android:layout_height="fill_parent" android:layout_width="fill_parent"> android:layout_height="fill_parent" android:layout_width="fill_parent">
<Button android:layout_width="wrap_content" <Button android:layout_width="wrap_content"
android:layout_marginLeft="5dp" android:layout_marginBottom ="5dp" android:layout_marginLeft="5dp" android:layout_marginBottom ="5dp"
@ -46,7 +57,4 @@
android:id="@+id/ExitButton" android:background="@drawable/exit"></Button> android:id="@+id/ExitButton" android:background="@drawable/exit"></Button>
</FrameLayout> </FrameLayout>
</FrameLayout>
</LinearLayout>

View file

@ -121,7 +121,7 @@ public class MapActivity extends Activity implements LocationListener, IMapLocat
ZoomControls zoomControls = (ZoomControls) findViewById(R.id.ZoomControls01); ZoomControls zoomControls = (ZoomControls) findViewById(R.id.ZoomControls);
zoomControls.setOnZoomInClickListener(new OnClickListener() { zoomControls.setOnZoomInClickListener(new OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {

View file

@ -0,0 +1,31 @@
package com.osmand.views;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.ZoomControls;
public class OsmZoomControls extends ZoomControls {
public OsmZoomControls(Context context, AttributeSet attrs) {
super(context, attrs);
}
public OsmZoomControls(Context context) {
super(context);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
// Ugly code : force buttons be equal size.
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
LayoutParams layoutParams = (android.widget.LinearLayout.LayoutParams) getChildAt(0).getLayoutParams();
layoutParams.width = getMeasuredWidth()/ 2 ;
layoutParams = (android.widget.LinearLayout.LayoutParams) getChildAt(1).getLayoutParams();
layoutParams.width = getMeasuredWidth()/ 2 ;
super.onMeasure(getMeasuredWidth(), getMeasuredHeight());
}
}

View file

@ -18,7 +18,7 @@ import com.osmand.osm.MapUtils;
public class POIMapLayer implements OsmandMapLayer { public class POIMapLayer implements OsmandMapLayer {
// it is very slow to use with 15 level // it is very slow to use with 15 level
private static final int startZoom = 16; private static final int startZoom = 15;
private Paint pointAltUI; private Paint pointAltUI;
private OsmandMapTileView view; private OsmandMapTileView view;
@ -79,6 +79,8 @@ public class POIMapLayer implements OsmandMapLayer {
public int getRadiusPoi(int zoom){ public int getRadiusPoi(int zoom){
if(zoom < startZoom){ if(zoom < startZoom){
return 0; return 0;
} else if(zoom == 15){
return 7;
} else if(zoom == 16){ } else if(zoom == 16){
return 10; return 10;
} else if(zoom == 17){ } else if(zoom == 17){