diff options
author | Dmitry Kunin <dkunin@mapswith.me> | 2013-09-19 19:21:13 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:02:21 +0300 |
commit | f3d4db441585b4615b5d59dcedb5b505bd2d13b9 (patch) | |
tree | 77c51f48fea938180887520d2d24f397c77b10de | |
parent | 127801a9ebc2847b40e4a67e2b83e4e84c20a2a6 (diff) |
[yota] Yopme button landscape fix.
-rw-r--r-- | android/res/layout/map.xml | 25 | ||||
-rw-r--r-- | android/res/values-land/dimen.xml | 6 | ||||
-rw-r--r-- | android/res/values/dimens.xml | 10 | ||||
-rw-r--r-- | android/src/com/mapswithme/maps/MWMActivity.java | 24 |
4 files changed, 33 insertions, 32 deletions
diff --git a/android/res/layout/map.xml b/android/res/layout/map.xml index b078d7267c..9992fd5070 100644 --- a/android/res/layout/map.xml +++ b/android/res/layout/map.xml @@ -52,15 +52,7 @@ android:singleLine="true" /> </LinearLayout> - <ImageButton - android:id="@+id/yop_it" - style="@style/Widget.MapButtonZoom" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="top|right" - android:src="@drawable/ptb_selector_map" /> - - <LinearLayout + <RelativeLayout android:id="@+id/navigation_buttons_container" android:layout_width="wrap_content" android:layout_height="fill_parent" @@ -69,10 +61,21 @@ android:orientation="vertical" > <ImageButton + android:id="@+id/yop_it" + style="@style/Widget.MapButtonZoom" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentRight="true" + android:src="@drawable/ptb_selector_map" /> + + <ImageButton android:id="@+id/map_button_plus" style="@style/Widget.MapButtonZoom" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:layout_alignParentRight="true" + android:layout_below="@+id/yop_it" + android:layout_marginTop="@dimen/zoom_plus_top_margin" android:onClick="onPlusClicked" android:src="@drawable/zoom_in_button" /> @@ -81,9 +84,11 @@ style="@style/Widget.MapButtonZoom" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:layout_alignParentRight="true" + android:layout_below="@+id/map_button_plus" android:onClick="onMinusClicked" android:src="@drawable/zoom_out_button" /> - </LinearLayout> + </RelativeLayout> <LinearLayout android:id="@+id/map_butons_container" diff --git a/android/res/values-land/dimen.xml b/android/res/values-land/dimen.xml new file mode 100644 index 0000000000..3b19dd9822 --- /dev/null +++ b/android/res/values-land/dimen.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + + <dimen name="zoom_plus_top_margin">20dp</dimen> + +</resources>
\ No newline at end of file diff --git a/android/res/values/dimens.xml b/android/res/values/dimens.xml index 0c3532e62e..a8cc514886 100644 --- a/android/res/values/dimens.xml +++ b/android/res/values/dimens.xml @@ -4,13 +4,10 @@ <dimen name="icon_size">24dp</dimen> <dimen name="activity_horizontal_margin">16dp</dimen> <dimen name="activity_vertical_margin">16dp</dimen> - <dimen name="margin_tiny">4dp</dimen> <dimen name="margin_small">8dp</dimen> <dimen name="margin_medium">16dp</dimen> <dimen name="margin_large">32dp</dimen> - - <dimen name="dp_x_1">4dp</dimen> <dimen name="dp_x_2">8dp</dimen> <dimen name="dp_x_3">12dp</dimen> @@ -21,12 +18,13 @@ <dimen name="dp_x_14">56dp</dimen> <dimen name="dp_x_16">64dp</dimen> <dimen name="dp_x_20">80dp</dimen> - <dimen name="sp_x_1">5dp</dimen> <dimen name="sp_x_2">10sp</dimen> <dimen name="sp_x_3">15sp</dimen> <dimen name="sp_x_4">20sp</dimen> <dimen name="sp_x_5">25sp</dimen> - <dimen name="dialog_max_height">320dp</dimen> -</resources> + <dimen name="zoom_plus_top_margin">40dp</dimen> + <dimen name="zoom_margin">5dp</dimen> + +</resources>
\ No newline at end of file diff --git a/android/src/com/mapswithme/maps/MWMActivity.java b/android/src/com/mapswithme/maps/MWMActivity.java index 87983810a9..c61759f4c4 100644 --- a/android/src/com/mapswithme/maps/MWMActivity.java +++ b/android/src/com/mapswithme/maps/MWMActivity.java @@ -19,7 +19,6 @@ import android.net.Uri; import android.os.Bundle; import android.os.Environment; import android.telephony.TelephonyManager; -import android.util.DisplayMetrics; import android.util.Log; import android.view.KeyEvent; import android.view.Menu; @@ -31,7 +30,7 @@ import android.view.ViewGroup.LayoutParams; import android.view.ViewGroup.MarginLayoutParams; import android.widget.ImageButton; import android.widget.ImageView; -import android.widget.LinearLayout; +import android.widget.RelativeLayout; import android.widget.TextView; import android.widget.Toast; @@ -45,7 +44,6 @@ import com.mapswithme.maps.promo.PromocodeActivationDialog; import com.mapswithme.maps.settings.UnitLocale; import com.mapswithme.maps.state.SuppotedState; import com.mapswithme.util.ConnectionState; -import com.mapswithme.util.UiUtils; import com.mapswithme.util.Utils; import com.mapswithme.util.Yota; import com.nvidia.devtech.NvEventQueueActivity; @@ -603,7 +601,7 @@ public class MWMActivity extends NvEventQueueActivity implements LocationService // yota setup mYopItButton = findViewById(R.id.yop_it); if (!Yota.isYota()) - UiUtils.hide(mYopItButton); + mYopItButton.setVisibility(View.INVISIBLE); else { mYopItButton.setOnClickListener(new OnClickListener() @@ -670,18 +668,11 @@ public class MWMActivity extends NvEventQueueActivity implements LocationService private void alignZoomButtons() { - // Get screen density - final DisplayMetrics metrics = new DisplayMetrics(); - getWindowManager().getDefaultDisplay().getMetrics(metrics); - - final double k = metrics.density; - final int offs = (int)(53 * k); // height of button + half space between buttons. - final int margin = (int)(5 * k); - - final LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, - LinearLayout.LayoutParams.WRAP_CONTENT); - lp.setMargins(margin, (metrics.heightPixels / 4) - offs, margin, margin); - findViewById(R.id.map_button_plus).setLayoutParams(lp); + final View zoomPlusButton = findViewById(R.id.map_button_plus); + final RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) zoomPlusButton.getLayoutParams(); + final int margin = (int) getResources().getDimension(R.dimen.zoom_margin); + final int marginTop = (int) getResources().getDimension(R.dimen.zoom_plus_top_margin); + lp.setMargins(margin, marginTop, margin, margin); } /// @name From Location interface @@ -1209,3 +1200,4 @@ public class MWMActivity extends NvEventQueueActivity implements LocationService public native boolean showMapForUrl(String url); } +//
\ No newline at end of file |