This commit is contained in:
Victor Shcherb 2015-03-15 01:45:16 +01:00
parent 1bfaf5e1c6
commit 14c6c1abd8
9 changed files with 51 additions and 71 deletions

View file

@ -5,11 +5,9 @@
android:layout_height="match_parent" >
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/MapViewWithLayers"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/MapViewWithLayers"
android:clipChildren="false"
android:keepScreenOn="true"
android:orientation="vertical" >
@ -33,7 +31,7 @@
android:layout_height="fill_parent"
android:contentDescription="@string/shared_string_map"
android:visibility="gone" />
<!-- deprecated -->
<FrameLayout
@ -52,8 +50,8 @@
android:id="@+id/MapButtons"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>
<FrameLayout
android:id="@+id/MapHudButtonsOverlay"
android:layout_width="match_parent"
@ -67,7 +65,6 @@
android:layout_height="match_parent"
layout="@layout/dashboard_over_map" />
<ListView
android:id="@+id/left_drawer"
android:layout_width="280dp"

View file

@ -1,6 +1,5 @@
<?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="match_parent"
android:orientation="vertical" >
@ -8,9 +7,9 @@
<!-- TOP ROW -->
<LinearLayout
android:id="@+id/map_top_bar"
android:layout_width="fill_parent"
android:layout_height="@dimen/map_address_height"
android:id="@+id/map_top_bar"
android:background="@drawable/btn_flat"
android:orientation="horizontal" >
@ -36,8 +35,7 @@
android:text="Long Street Name"
android:textColor="@color/color_black"
android:textSize="@dimen/map_widget_text_size"
android:textStyle="bold"
android:visibility="gone" >
android:textStyle="bold" >
</TextView>
<ImageButton
@ -69,7 +67,6 @@
android:weightSum="1" >
<LinearLayout
android:id="@+id/map_left_widgets_panel"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="top|left"
@ -77,6 +74,7 @@
android:orientation="vertical" >
<LinearLayout
android:id="@+id/map_left_widgets_panel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|left"
@ -127,16 +125,15 @@
android:layout_height="wrap_content"
android:layout_gravity="top|center"
android:background="@drawable/btn_round"
android:orientation="vertical"
>
android:orientation="vertical" >
<ProgressBar
android:id="@+id/map_horizontal_progress"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_height="wrap_content"
android:max="100"
android:progress="60"
android:visibility="gone"/>
android:visibility="gone" />
</LinearLayout>
<!-- RIGHT widgets colon -->
@ -154,40 +151,41 @@
android:layout_weight="0.6" >
</LinearLayout>
<LinearLayout
<FrameLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="top|right"
android:layout_weight="0.4"
android:orientation="vertical" >
android:layout_weight="0.4" >
<LinearLayout
android:id="@+id/map_right_widgets_panel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|right"
android:orientation="vertical" >
<!--
<LinearLayout
android:id="@+id/map_right_widgets_panel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|right"
android:orientation="vertical" >
<include layout="@layout/map_hud_widget" />
<!--
<include layout="@layout/map_hud_widget" />
<include layout="@layout/map_hud_widget" />
<include layout="@layout/map_hud_widget" />
-->
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
-->
</LinearLayout>
<ImageButton
android:id="@+id/map_collapse_button"
android:layout_width="@dimen/map_button_size"
android:layout_height="@dimen/map_button_size"
android:layout_gravity="center"
android:layout_gravity="top|center_horizontal"
android:background="@drawable/btn_inset_circle"
android:src="@drawable/ic_action_remove_light" />
</FrameLayout>
</LinearLayout>
</LinearLayout>
</FrameLayout>
</LinearLayout>
</FrameLayout>

View file

@ -4,7 +4,7 @@
android:layout_height="fill_parent" >
<ImageButton
android:id="@+id/map_layers_button"
android:id="@+id/map_menu_button"
android:layout_width="@dimen/map_button_size"
android:layout_height="@dimen/map_button_size"
android:layout_gravity="top|left"

View file

@ -134,9 +134,7 @@ public class MapActivity extends AccessibleActivity {
// Full screen is not used here
// getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.main);
mapView = new OsmandMapTileView();
mapView.init(this);
mapView = new OsmandMapTileView(this);
mapActions = new MapActivityActions(this);
mapLayers = new MapActivityLayers(this);
if (mapViewTrackingUtilities == null) {

View file

@ -104,10 +104,10 @@ public class StartGPSStatus extends OsmAndAction {
}
OsmandMapTileView view = mapActivity.getMapView();
AlertDialog.Builder builder = new AccessibleAlertBuilder(mapActivity);
LinearLayout ll = new LinearLayout(view.getContext());
final ListView lv = new ListView(view.getContext());
LinearLayout ll = new LinearLayout(activity);
final ListView lv = new ListView(activity);
lv.setPadding(7, 3, 7, 0);
final CheckBox cb = new CheckBox(view.getContext());
final CheckBox cb = new CheckBox(activity);
cb.setText(R.string.shared_string_remember_my_choice);
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
lp.setMargins(7, 10, 7, 0);

View file

@ -95,7 +95,7 @@ public class DashboardOnMap {
dashboardView.setOnClickListener(listener);
switchButton = (ImageView) dashboardView.findViewById(R.id.map_layers_button);
switchButton = (ImageView) dashboardView.findViewById(R.id.map_menu_button);
switchButton.setOnClickListener(new View.OnClickListener() {
@Override
@ -185,7 +185,7 @@ public class DashboardOnMap {
R.color.icon_color_light));
mapActivity.getMapActions().disableDrawer();
mapActivity.findViewById(R.id.MapHudButtonsOverlay).setVisibility(View.GONE);
mapActivity.findViewById(R.id.MapHudButtonsOverlay).setVisibility(View.INVISIBLE);
updateLocation(true, true, false);
} else {

View file

@ -96,11 +96,12 @@ public class MapControlsLayer extends OsmandMapLayer {
// rulerControl = init(new RulerControl(zoomControls, mapActivity, showUIHandler, scaleCoefficient), parent,
// rightGravity);
showUIHandler = new Handler();
initTopControls();
initTransparencyBar();
initZooms();
initControls();
initRouteControls();
initTopControls();
}
private class CompassDrawable extends Drawable {

View file

@ -31,6 +31,7 @@ import net.osmand.util.MapUtils;
import org.apache.commons.logging.Log;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
@ -53,7 +54,6 @@ import android.view.MotionEvent;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.View;
import android.view.ViewParent;
import android.view.WindowManager;
import android.widget.Toast;
@ -67,6 +67,9 @@ public class OsmandMapTileView implements IMapDownloaderCallback {
private FPSMeasurement main = new FPSMeasurement();
private FPSMeasurement additional = new FPSMeasurement();
private View view;
private Activity activity;
private OsmandApplication application;
protected OsmandSettings settings = null;
private class FPSMeasurement {
int fpsMeasureCount = 0;
@ -146,13 +149,8 @@ public class OsmandMapTileView implements IMapDownloaderCallback {
Paint paintCenter;
private DisplayMetrics dm;
private MapRendererView mapRenderer;
private OsmandApplication application;
protected OsmandSettings settings = null;
private Bitmap bufferBitmap;
private RotatedTileBox bufferImgLoc;
private Bitmap bufferBitmapTmp;
@ -167,14 +165,16 @@ public class OsmandMapTileView implements IMapDownloaderCallback {
getAnimatedDraggingThread().startZooming(getZoom() - 1, currentViewport.getZoomFloatPart(), true);
}
};
public OsmandMapTileView(Activity activity) {
this.activity = activity;
init(activity);
}
// ///////////////////////////// INITIALIZING UI PART ///////////////////////////////////
public void init(Context ctx) {
application = (OsmandApplication) ctx.getApplicationContext();
settings = application.getSettings();
paintGrayFill = new Paint();
paintGrayFill.setColor(Color.GRAY);
paintGrayFill.setStyle(Style.FILL);
@ -396,9 +396,6 @@ public class OsmandMapTileView implements IMapDownloaderCallback {
}
public OsmandSettings getSettings() {
if (settings == null) {
settings = getApplication().getSettings();
}
return settings;
}
@ -977,23 +974,12 @@ public class OsmandMapTileView implements IMapDownloaderCallback {
}
}
public Resources getResources() {
return application.getResources();
}
public Context getContext() {
return view.getContext();
}
public int getHeight() {
return view.getHeight();
}
public float getWidth() {
return view.getWidth();
return activity;
}
}

View file

@ -14,7 +14,6 @@ import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.text.TextPaint;
import android.view.View;
import android.widget.FrameLayout;
public class RulerControl {
@ -74,7 +73,8 @@ public class RulerControl {
rulerDrawable = (isNight ? mapActivity.getResources().getDrawable(R.drawable.ruler_night) : mapActivity
.getResources().getDrawable(R.drawable.ruler));
Rect bounds = rulerDrawable.getBounds();
bounds.right = (int) (view.getWidth() - 7 * scaleCoefficient);
// TODO
// bounds.right = (int) (view.getWidth() - 7 * scaleCoefficient);
bounds.left = bounds.right - cacheRulerDistPix;
rulerDrawable.setBounds(bounds);
rulerDrawable.invalidateSelf();
@ -82,13 +82,13 @@ public class RulerControl {
if (cacheRulerText != null) {
Rect bounds = rulerDrawable.getBounds();
int bottom = (int) (view.getHeight() );
if (bounds.bottom != bottom) {
bounds.bottom = bottom;
bounds.top = bounds.bottom - rulerDrawable.getMinimumHeight();
rulerDrawable.setBounds(bounds);
rulerDrawable.invalidateSelf();
}
// int bottom = (int) (view.getHeight() );
// if (bounds.bottom != bottom) {
// bounds.bottom = bottom;
// bounds.top = bounds.bottom - rulerDrawable.getMinimumHeight();
// rulerDrawable.setBounds(bounds);
// rulerDrawable.invalidateSelf();
// }
rulerDrawable.draw(canvas);
int shadowColor = isNight == true ? mapActivity.getResources().getColor(R.color.widgettext_shadow_night)
: Color.WHITE;