forked from organicmaps/organicmaps
[yota] Yopme button landscape fix.
This commit is contained in:
parent
127801a9eb
commit
f3d4db4415
4 changed files with 33 additions and 32 deletions
|
@ -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"
|
||||
|
@ -68,11 +60,22 @@
|
|||
android:gravity="top"
|
||||
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"
|
||||
|
|
6
android/res/values-land/dimen.xml
Normal file
6
android/res/values-land/dimen.xml
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<dimen name="zoom_plus_top_margin">20dp</dimen>
|
||||
|
||||
</resources>
|
|
@ -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>
|
|
@ -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);
|
||||
}
|
||||
//
|
Loading…
Add table
Reference in a new issue