Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
901893ec85
7 changed files with 163 additions and 15 deletions
28
OsmAnd/res/layout/drawer_list_material_item.xml
Normal file
28
OsmAnd/res/layout/drawer_list_material_item.xml
Normal file
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="56dp"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
android:layout_weight="1"
|
||||
android:layout_gravity="center_vertical"
|
||||
tools:text="Some title text" />
|
||||
|
||||
<android.support.v7.widget.SwitchCompat
|
||||
android:id="@+id/check_item"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:focusable="false"
|
||||
android:layout_gravity="center_vertical" />
|
||||
|
||||
</LinearLayout>
|
33
OsmAnd/res/layout/progress_list_item.xml
Normal file
33
OsmAnd/res/layout/progress_list_item.xml
Normal file
|
@ -0,0 +1,33 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:descendantFocusability="blocksDescendants"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="@dimen/list_item_height"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="16dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
tools:text="Germany"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
<SeekBar
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
32
OsmAnd/res/layout/two_line_list_item.xml
Normal file
32
OsmAnd/res/layout/two_line_list_item.xml
Normal file
|
@ -0,0 +1,32 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:descendantFocusability="blocksDescendants"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="@dimen/list_item_height"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
tools:text="Germany"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/subtitle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:maxLines="25"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_sub_text_size"
|
||||
tools:text="Contour Lines"/>
|
||||
|
||||
</LinearLayout>
|
|
@ -9,6 +9,8 @@
|
|||
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
|
||||
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
|
||||
-->
|
||||
<string name="show_polygons">Show polygons</string>
|
||||
<string name="underlay_transparency">Underlay transparency</string>
|
||||
<string name="find_parking">Find a parking</string>
|
||||
<string name="shared_string_status">Status</string>
|
||||
<string name="shared_string_save_changes">Save changes</string>
|
||||
|
|
|
@ -51,6 +51,7 @@ import net.osmand.plus.dashboard.tools.DashFragmentData;
|
|||
import net.osmand.plus.dashboard.tools.DashboardSettingsDialogFragment;
|
||||
import net.osmand.plus.dashboard.tools.TransactionBuilder;
|
||||
import net.osmand.plus.dialogs.ConfigureMapMenu;
|
||||
import net.osmand.plus.dialogs.UnderlayMapMenu;
|
||||
import net.osmand.plus.download.DownloadActivity;
|
||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||
import net.osmand.plus.helpers.WaypointDialogHelper;
|
||||
|
@ -155,7 +156,8 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
|||
CONFIGURE_MAP,
|
||||
LIST_MENU,
|
||||
ROUTE_PREFERENCES,
|
||||
DASHBOARD
|
||||
DASHBOARD,
|
||||
UNDERLAY_MAP
|
||||
}
|
||||
|
||||
private Map<DashboardActionButtonType, DashboardActionButton> actionButtons = new HashMap<>();
|
||||
|
@ -350,6 +352,8 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
|||
tv.setText(R.string.layer_map_appearance);
|
||||
} else if (visibleType == DashboardType.ROUTE_PREFERENCES) {
|
||||
tv.setText(R.string.shared_string_settings);
|
||||
} else if (visibleType == DashboardType.UNDERLAY_MAP) {
|
||||
tv.setText(R.string.map_underlay);
|
||||
}
|
||||
ImageView edit = (ImageView) dashboardView.findViewById(R.id.toolbar_edit);
|
||||
edit.setVisibility(View.GONE);
|
||||
|
@ -689,11 +693,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
|||
|
||||
private int dpToPx(float dp) {
|
||||
Resources r = mapActivity.getResources();
|
||||
return (int) TypedValue.applyDimension(
|
||||
COMPLEX_UNIT_DIP,
|
||||
dp,
|
||||
r.getDisplayMetrics()
|
||||
);
|
||||
return (int) TypedValue.applyDimension(COMPLEX_UNIT_DIP, dp, r.getDisplayMetrics());
|
||||
}
|
||||
|
||||
private void updateListAdapter() {
|
||||
|
@ -722,6 +722,8 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
|||
ArrayAdapter<LocalRoutingParameter> listAdapter = routePreferencesMenu.getRoutePreferencesDrawerAdapter(nightMode);
|
||||
OnItemClickListener listener = routePreferencesMenu.getItemClickListener(listAdapter);
|
||||
updateListAdapter(listAdapter, listener);
|
||||
} else if (DashboardType.UNDERLAY_MAP == visibleType) {
|
||||
cm = UnderlayMapMenu.createListAdapter(mapActivity);
|
||||
}
|
||||
if (cm != null) {
|
||||
updateListAdapter(cm);
|
||||
|
|
56
OsmAnd/src/net/osmand/plus/dialogs/UnderlayMapMenu.java
Normal file
56
OsmAnd/src/net/osmand/plus/dialogs/UnderlayMapMenu.java
Normal file
|
@ -0,0 +1,56 @@
|
|||
package net.osmand.plus.dialogs;
|
||||
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.ArrayAdapter;
|
||||
|
||||
import net.osmand.plus.ContextMenuAdapter;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
|
||||
public class UnderlayMapMenu {
|
||||
private static final String TAG = "UnderlayMapMenu";
|
||||
|
||||
public static ContextMenuAdapter createListAdapter(final MapActivity ma) {
|
||||
ContextMenuAdapter adapter = new ContextMenuAdapter(ma, false);
|
||||
adapter.setDefaultLayoutId(R.layout.drawer_list_material_item);
|
||||
createLayersItems(adapter, ma);
|
||||
return adapter;
|
||||
}
|
||||
|
||||
private static void createLayersItems(ContextMenuAdapter adapter , MapActivity activity) {
|
||||
OsmandApplication app = activity.getMyApplication();
|
||||
OsmandSettings settings = app.getSettings();
|
||||
ContextMenuAdapter.OnRowItemClick l = new ContextMenuAdapter.OnRowItemClick() {
|
||||
@Override
|
||||
public boolean onRowItemClick(ArrayAdapter<?> adapter, View view, int itemId, int pos) {
|
||||
Log.v(TAG, "onRowItemClick(" + "adapter=" + adapter + ", view=" + view + ", itemId=" + itemId + ", pos=" + pos + ")");
|
||||
return super.onRowItemClick(adapter, view, itemId, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||
Log.v(TAG, "onContextMenuClick(" + "adapter=" + adapter + ", itemId=" + itemId + ", pos=" + pos + ", isChecked=" + isChecked + ")");
|
||||
return false;
|
||||
}
|
||||
};
|
||||
adapter.item(R.string.shared_string_show).listen(l).reg();
|
||||
// String appMode = " [" + settings.getApplicationMode().toHumanString(view.getApplication()) +"] ";
|
||||
adapter.item(R.string.underlay_transparency).layout(R.layout.progress_list_item).reg();
|
||||
adapter.item(R.string.map_underlay).layout(R.layout.two_line_list_item).listen(l).reg();
|
||||
adapter.item(R.string.show_polygons).listen(l).reg();
|
||||
|
||||
// .selected(overlayLayer != null && overlayLayer.getMap() != null ? 1 : 0)
|
||||
|
||||
// if(underlayLayer.getMap() != null){
|
||||
// settings.MAP_UNDERLAY.set(null);
|
||||
// updateMapLayers(mapView, null, layers);
|
||||
// layers.getMapControlsLayer().hideTransparencyBar(settings.MAP_TRANSPARENCY);
|
||||
// } else {
|
||||
// selectMapOverlayLayer(mapView, settings.MAP_UNDERLAY,settings.MAP_TRANSPARENCY,
|
||||
// mapActivity);
|
||||
// }
|
||||
}
|
||||
}
|
|
@ -31,6 +31,7 @@ import net.osmand.plus.Version;
|
|||
import net.osmand.plus.activities.DownloadTilesDialog;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.MapActivityLayers;
|
||||
import net.osmand.plus.dashboard.DashboardOnMap;
|
||||
import net.osmand.plus.views.MapTileLayer;
|
||||
import net.osmand.plus.views.OsmandMapTileView;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
@ -215,14 +216,8 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
|
|||
selectMapOverlayLayer(mapView, settings.MAP_OVERLAY, settings.MAP_OVERLAY_TRANSPARENCY, mapActivity);
|
||||
}
|
||||
} else if(itemId == R.string.layer_underlay){
|
||||
if(underlayLayer.getMap() != null){
|
||||
settings.MAP_UNDERLAY.set(null);
|
||||
updateMapLayers(mapView, null, layers);
|
||||
layers.getMapControlsLayer().hideTransparencyBar(settings.MAP_TRANSPARENCY);
|
||||
} else {
|
||||
selectMapOverlayLayer(mapView, settings.MAP_UNDERLAY,settings.MAP_TRANSPARENCY,
|
||||
mapActivity);
|
||||
}
|
||||
mapActivity.getDashboard().setDashboardVisibility(true, DashboardOnMap.DashboardType.UNDERLAY_MAP);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -230,7 +225,7 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
|
|||
|
||||
adapter.item(R.string.layer_overlay).selected(overlayLayer != null && overlayLayer.getMap() != null ? 1 : 0).
|
||||
iconColor(R.drawable.ic_layer_top_dark).listen(listener).position(14).reg();
|
||||
adapter.item(R.string.layer_underlay).selected(underlayLayer != null && underlayLayer.getMap() != null ? 1 : 0)
|
||||
adapter.item(R.string.layer_underlay)
|
||||
.iconColor(R.drawable.ic_layer_bottom_dark).listen(listener).position(15).reg();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue