Add ability to move map to the selected point

This commit is contained in:
Alexander Sytnyk 2017-08-07 17:28:58 +03:00
parent 2ef81d2048
commit 191505c0c2
3 changed files with 15 additions and 1 deletions

View file

@ -3,7 +3,8 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="48dp">
android:layout_height="48dp"
android:descendantFocusability="blocksDescendants">
<android.support.v7.widget.AppCompatImageView
android:id="@+id/measure_point_icon"
@ -26,6 +27,7 @@
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:background="@null"
android:focusableInTouchMode="true"
android:paddingBottom="12dp"
android:paddingEnd="16dp"
android:paddingStart="16dp"

View file

@ -19,6 +19,7 @@ import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
@ -214,6 +215,12 @@ public class MeasurementToolFragment extends Fragment {
ListView lv = mainView.findViewById(R.id.measure_points_list_view);
lv.setDivider(null);
lv.setAdapter(adapter);
lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int pos, long l) {
measurementLayer.moveMapToPoint(pos);
}
});
return view;
}

View file

@ -178,6 +178,11 @@ public class MeasurementToolLayer extends OsmandMapLayer implements ContextMenuL
return cacheMeasurementPoints.size() > measurementPoints.size();
}
void moveMapToPoint(int pos) {
WptPt pt = measurementPoints.get(pos);
view.getAnimatedDraggingThread().startMoving(pt.getLatitude(), pt.getLongitude(), view.getZoom(), true);
}
@Override
public void destroyLayer() {