From 78e435a47c0b5194d883d4c3b70453784d637b8a Mon Sep 17 00:00:00 2001 From: rachytski Date: Thu, 19 Jul 2012 14:31:10 -0700 Subject: [PATCH] navigation buttons are positioned at top-right side of display. --- android/res/layout/map.xml | 6 +++--- android/src/com/mapswithme/maps/MWMActivity.java | 10 ++++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/android/res/layout/map.xml b/android/res/layout/map.xml index 57ca54db95..ef2c21eda6 100644 --- a/android/res/layout/map.xml +++ b/android/res/layout/map.xml @@ -9,7 +9,7 @@ android:id="@+id/navigation_buttons_container" android:layout_width="wrap_content" android:layout_height="fill_parent" - android:gravity="bottom" + android:gravity="top" android:layout_gravity="right" android:orientation="vertical"> @@ -19,7 +19,7 @@ android:layout_height="wrap_content" android:background="@drawable/zoom_in_button" android:onClick="onPlusClicked" - android:layout_marginTop="10dip" + android:layout_marginTop="5dip" android:layout_marginBottom="5dip" android:layout_marginLeft="5dip" android:layout_marginRight="5dip"/> @@ -33,7 +33,7 @@ android:layout_marginTop="5dip" android:layout_marginLeft="5dip" android:layout_marginRight="5dip" - android:layout_marginBottom="58dip"/> + android:layout_marginBottom="5dip"/> diff --git a/android/src/com/mapswithme/maps/MWMActivity.java b/android/src/com/mapswithme/maps/MWMActivity.java index 917b377ec1..813e3ec90f 100644 --- a/android/src/com/mapswithme/maps/MWMActivity.java +++ b/android/src/com/mapswithme/maps/MWMActivity.java @@ -18,6 +18,7 @@ import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.webkit.WebView; +import android.widget.LinearLayout; import com.mapswithme.maps.location.LocationService; import com.nvidia.devtech.NvEventQueueActivity; @@ -330,6 +331,15 @@ public class MWMActivity extends NvEventQueueActivity implements LocationService DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); + double k = metrics.density; + + int offs = (int)(53 * k); // height of button + half space between buttons. + + LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, + LinearLayout.LayoutParams.WRAP_CONTENT); + lp.setMargins((int)(5 * k), (int)(metrics.heightPixels / 4) - offs, (int)(5 * k), (int)(5 * k)); + findViewById(R.id.map_button_plus).setLayoutParams(lp); + //m_timer = new VideoTimer(); }