Fix layout issues
This commit is contained in:
parent
38192aae64
commit
ccad661057
10 changed files with 63 additions and 52 deletions
18
OsmAnd/res/drawable/drawer_divider.xml
Normal file
18
OsmAnd/res/drawable/drawer_divider.xml
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<inset xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:insetLeft="15dp"
|
||||
android:insetRight="15dp" >
|
||||
|
||||
<shape
|
||||
android:shape="line" >
|
||||
<stroke
|
||||
android:dashGap="1dp"
|
||||
android:dashWidth="1.5dp"
|
||||
android:width="1dp"
|
||||
android:color="#FF404040" />
|
||||
|
||||
<size android:height="1dp" />
|
||||
|
||||
</shape>
|
||||
|
||||
</inset>
|
|
@ -10,22 +10,27 @@
|
|||
<LinearLayout android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal"
|
||||
android:layout_height="64dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:paddingTop="8dp">
|
||||
android:layout_height="32dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp">
|
||||
<TextView android:id="@+id/title"
|
||||
android:textSize="18sp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="center_vertical"
|
||||
android:maxLines="2"
|
||||
android:layout_height="wrap_content"/>
|
||||
<TextView android:id="@+id/descr"
|
||||
android:textSize="14sp"
|
||||
android:layout_weight="1"
|
||||
android:textColor="#bebebe"
|
||||
android:layout_width="48dp"
|
||||
android:layout_width="64dp"
|
||||
android:layout_marginLeft="4dp"
|
||||
android:gravity="right"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:layout_gravity="center|right"
|
||||
android:layout_gravity="center_vertical|right"
|
||||
android:layout_height="wrap_content"/>
|
||||
</LinearLayout>
|
||||
<CheckBox
|
||||
|
|
|
@ -17,27 +17,18 @@
|
|||
android:layout_gravity="center_vertical"
|
||||
tools:src="@drawable/ic_action_info_dark" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="11dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_gravity="bottom" >
|
||||
|
||||
<TextView
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="18sp"
|
||||
android:layout_marginBottom="17dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginLeft="11dp"
|
||||
tools:text="Some title text" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/descr"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/check_item"
|
||||
android:layout_width="wrap_content"
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingLeft="24dp"
|
||||
android:layout_marginBottom="4dp">
|
||||
android:paddingBottom="4dp">
|
||||
<TextView android:id="@+id/title"
|
||||
android:layout_weight="1"
|
||||
android:layout_width="0dp"
|
||||
|
@ -15,5 +15,5 @@
|
|||
android:textSize="14sp"
|
||||
android:ellipsize="end"
|
||||
android:gravity="left|bottom"/>
|
||||
x` <!-- android:maxLines="2" -->
|
||||
<!-- android:maxLines="2" -->
|
||||
</LinearLayout>
|
|
@ -126,14 +126,13 @@ public class MapActivity extends AccessibleActivity {
|
|||
app.applyTheme(this);
|
||||
super.onCreate(savedInstanceState);
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
|
||||
|
||||
|
||||
mapActions = new MapActivityActions(this);
|
||||
mapLayers = new MapActivityLayers(this);
|
||||
// Full screen is not used here
|
||||
//getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
setContentView(R.layout.main);
|
||||
|
||||
mapActions = new MapActivityActions(this);
|
||||
mapLayers = new MapActivityLayers(this);
|
||||
|
||||
startProgressDialog = new ProgressDialog(this);
|
||||
startProgressDialog.setCancelable(true);
|
||||
app.checkApplicationIsBeingInitialized(this, startProgressDialog);
|
||||
|
|
|
@ -768,6 +768,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
final ArrayAdapter<?> listAdapter =
|
||||
cm.createListAdapter(mapActivity, getMyApplication().getSettings().isLightContentMenu());
|
||||
mDrawerList.setAdapter(listAdapter);
|
||||
mDrawerList.setDivider(mapActivity.getResources().getDrawable(R.drawable.drawer_shadow));
|
||||
mDrawerList.setBackgroundColor(cm.getBackgroundColor(mapActivity, getMyApplication().getSettings().isLightContentMenu()));
|
||||
mDrawerList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
|
||||
|
|
|
@ -62,7 +62,9 @@ public class WaypointDialogHelper implements OsmAndLocationListener {
|
|||
waypointHelper = this.app.getWaypointHelper();
|
||||
this.mapActivity = mapActivity;
|
||||
this.mainLayout = (LinearLayout) mapActivity.findViewById(R.id.dialog_layout);
|
||||
|
||||
if(mainLayout == null) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
}
|
||||
|
||||
public void init() {
|
||||
|
|
|
@ -2,19 +2,17 @@ package net.osmand.plus.views;
|
|||
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import net.osmand.data.RotatedTileBox;
|
||||
import net.osmand.plus.ApplicationMode;
|
||||
import net.osmand.plus.ContextMenuAdapter;
|
||||
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.actions.AppModeDialog;
|
||||
import net.osmand.plus.routing.RoutingHelper;
|
||||
import net.osmand.plus.views.mapwidgets.AppearanceWidgetsFactory;
|
||||
import net.osmand.plus.views.mapwidgets.BaseMapWidget;
|
||||
|
@ -28,7 +26,6 @@ import net.osmand.plus.views.mapwidgets.RouteInfoWidgetsFactory;
|
|||
import net.osmand.plus.views.mapwidgets.StackWidgetView;
|
||||
import net.osmand.plus.views.mapwidgets.TextInfoWidget;
|
||||
import net.osmand.plus.views.mapwidgets.UpdateableWidget;
|
||||
import net.osmand.util.Algorithms;
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
|
@ -39,17 +36,10 @@ import android.graphics.drawable.Drawable;
|
|||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.View.MeasureSpec;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.AdapterView.OnItemClickListener;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.CompoundButton.OnCheckedChangeListener;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class MapInfoLayer extends OsmandMapLayer {
|
||||
|
||||
|
@ -232,6 +222,11 @@ public class MapInfoLayer extends OsmandMapLayer {
|
|||
public void createControls() {
|
||||
// 1. Create view groups and controls
|
||||
statusBar.setBackgroundDrawable(view.getResources().getDrawable(R.drawable.box_top));
|
||||
|
||||
// form measurement
|
||||
ImageView iv = new ImageView(map);
|
||||
iv.setImageDrawable(map.getResources().getDrawable(R.drawable.la_backtoloc_disabled));
|
||||
statusBar.addView(iv);
|
||||
rightStack = new StackWidgetView(view.getContext());
|
||||
leftStack = new StackWidgetView(view.getContext());
|
||||
|
||||
|
@ -239,7 +234,6 @@ public class MapInfoLayer extends OsmandMapLayer {
|
|||
Rect topRectPadding = new Rect();
|
||||
view.getResources().getDrawable(R.drawable.box_top).getPadding(topRectPadding);
|
||||
// for measurement
|
||||
//statusBar.addView(backToLocation);
|
||||
STATUS_BAR_MARGIN_X = (int) (STATUS_BAR_MARGIN_X * scaleCoefficient);
|
||||
statusBar.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED);
|
||||
Rect statusBarPadding = new Rect();
|
||||
|
@ -310,7 +304,7 @@ public class MapInfoLayer extends OsmandMapLayer {
|
|||
}).reg();
|
||||
|
||||
cm.item(R.string.map_widget_reset)
|
||||
.icons(R.drawable.widget_reset_to_default_light, R.drawable.widget_reset_to_default_dark).listen(new OnContextMenuClick() {
|
||||
.icons(R.drawable.widget_reset_to_default_dark, R.drawable.widget_reset_to_default_light).listen(new OnContextMenuClick() {
|
||||
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||
|
@ -353,8 +347,8 @@ public class MapInfoLayer extends OsmandMapLayer {
|
|||
for(final MapWidgetRegInfo r : top){
|
||||
// String s = mi.visibleCollapsed(mode)? " - " : " ";
|
||||
// tv.setText(s +map.getString(mi.messageId) +s);
|
||||
adapter.item(r.messageId)
|
||||
.icons(r.drawableLight, r.drawableDark).listen(new OnContextMenuClick() {
|
||||
adapter.item(r.messageId).selected(r.visibleCollapsed(mode) || r.visible(mode) ? 1 : 0)
|
||||
.icons(r.drawableDark, r.drawableLight).listen(new OnContextMenuClick() {
|
||||
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||
|
|
|
@ -26,7 +26,7 @@ public class AppearanceWidgetsFactory {
|
|||
// }
|
||||
// });
|
||||
|
||||
final MapWidgetRegistry.MapWidgetRegInfo showRuler = mapInfoControls.registerAppearanceWidget(R.drawable.widget_ruler, R.drawable.widget_ruler, R.string.map_widget_show_ruler,
|
||||
final MapWidgetRegistry.MapWidgetRegInfo showRuler = mapInfoControls.registerAppearanceWidget(0, 0, /*R.drawable.widget_ruler, R.drawable.widget_ruler, */R.string.map_widget_show_ruler,
|
||||
"showRuler", view.getSettings().SHOW_RULER);
|
||||
showRuler.setStateChangeListener(new Runnable() {
|
||||
@Override
|
||||
|
@ -35,7 +35,7 @@ public class AppearanceWidgetsFactory {
|
|||
view.refreshMap();
|
||||
}
|
||||
});
|
||||
final MapWidgetRegistry.MapWidgetRegInfo showDestinationArrow = mapInfoControls.registerAppearanceWidget(R.drawable.widget_show_destination_arrow, R.drawable.widget_show_destination_arrow, R.string.map_widget_show_destination_arrow,
|
||||
final MapWidgetRegistry.MapWidgetRegInfo showDestinationArrow = mapInfoControls.registerAppearanceWidget(0, 0, /*R.drawable.widget_show_destination_arrow, R.drawable.widget_show_destination_arrow, */R.string.map_widget_show_destination_arrow,
|
||||
"show_destination_arrow", view.getSettings().SHOW_DESTINATION_ARROW);
|
||||
showDestinationArrow.setStateChangeListener(new Runnable() {
|
||||
@Override
|
||||
|
@ -45,7 +45,7 @@ public class AppearanceWidgetsFactory {
|
|||
}
|
||||
});
|
||||
|
||||
final MapWidgetRegistry.MapWidgetRegInfo transparent = mapInfoControls.registerAppearanceWidget(R.drawable.widget_transparent_skin, R.drawable.widget_transparent_skin, R.string.map_widget_transparent,
|
||||
final MapWidgetRegistry.MapWidgetRegInfo transparent = mapInfoControls.registerAppearanceWidget(0, 0, /*R.drawable.widget_transparent_skin, R.drawable.widget_transparent_skin, */R.string.map_widget_transparent,
|
||||
"transparent", view.getSettings().TRANSPARENT_MAP_THEME);
|
||||
transparent.setStateChangeListener(new Runnable() {
|
||||
@Override
|
||||
|
@ -54,7 +54,7 @@ public class AppearanceWidgetsFactory {
|
|||
mapInfoLayer.recreateControls();
|
||||
}
|
||||
});
|
||||
final MapWidgetRegistry.MapWidgetRegInfo centerPosition = mapInfoControls.registerAppearanceWidget(R.drawable.widget_position_marker, R.drawable.widget_position_marker,
|
||||
final MapWidgetRegistry.MapWidgetRegInfo centerPosition = mapInfoControls.registerAppearanceWidget(0, 0, /*R.drawable.widget_position_marker, R.drawable.widget_position_marker,*/
|
||||
R.string.always_center_position_on_map,
|
||||
"centerPosition", view.getSettings().CENTER_POSITION_ON_MAP);
|
||||
centerPosition.setStateChangeListener(new Runnable() {
|
||||
|
|
|
@ -82,12 +82,13 @@ public class MapWidgetRegistry {
|
|||
}
|
||||
|
||||
|
||||
public MapWidgetRegInfo registerTopWidget(View m, int drawableDark,int drawableLight, int messageId, String key, int left, int priorityOrder) {
|
||||
public MapWidgetRegInfo registerTopWidget(View m, int drawableDark, int drawableLight, int messageId, String key,
|
||||
int left, int priorityOrder) {
|
||||
MapWidgetRegInfo ii = new MapWidgetRegInfo();
|
||||
ii.key = key;
|
||||
ii.visibleModes = new LinkedHashSet<ApplicationMode>();
|
||||
ii.visibleModes = new LinkedHashSet<ApplicationMode>();
|
||||
ii.visibleCollapsible = null;
|
||||
for(ApplicationMode ms : ApplicationMode.values(settings) ) {
|
||||
for (ApplicationMode ms : ApplicationMode.values(settings)) {
|
||||
boolean def = ms.isWidgetVisible(key);
|
||||
Set<String> set = visibleElementsFromSettings.get(ms);
|
||||
if (set != null) {
|
||||
|
@ -97,7 +98,7 @@ public class MapWidgetRegistry {
|
|||
def = false;
|
||||
}
|
||||
}
|
||||
if(def){
|
||||
if (def) {
|
||||
ii.visibleModes.add(ms);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue