Add small changes

This commit is contained in:
Alexander Sytnyk 2017-08-08 12:54:13 +03:00
parent 3dcc410fd7
commit 8f00527bd7
2 changed files with 6 additions and 5 deletions

View file

@ -19,8 +19,8 @@ import java.util.List;
class MeasurementToolAdapter extends RecyclerView.Adapter<MeasurementToolAdapter.Holder> {
private MapActivity mapActivity;
private List<WptPt> points;
private final MapActivity mapActivity;
private final List<WptPt> points;
private RemovePointListener removePointListener;
private ItemClickListener itemClickListener;

View file

@ -201,6 +201,7 @@ public class MeasurementToolFragment extends Fragment {
}
adapter = new MeasurementToolAdapter(getMapActivity(), measurementLayer.getMeasurementPoints());
final RecyclerView rv = mainView.findViewById(R.id.measure_points_recycler_view);
adapter.setRemovePointListener(new MeasurementToolAdapter.RemovePointListener() {
@Override
public void onPointRemove() {
@ -215,9 +216,6 @@ public class MeasurementToolFragment extends Fragment {
}
}
});
final RecyclerView rv = mainView.findViewById(R.id.measure_points_recycler_view);
rv.setLayoutManager(new LinearLayoutManager(getContext()));
rv.setAdapter(adapter);
adapter.setItemClickListener(new MeasurementToolAdapter.ItemClickListener() {
@Override
public void onItemClick(View view) {
@ -225,6 +223,8 @@ public class MeasurementToolFragment extends Fragment {
measurementLayer.moveMapToPoint(pos);
}
});
rv.setLayoutManager(new LinearLayoutManager(getContext()));
rv.setAdapter(adapter);
return view;
}
@ -391,6 +391,7 @@ public class MeasurementToolFragment extends Fragment {
super.onDestroyView();
exitMeasurementMode();
adapter.setRemovePointListener(null);
adapter.setItemClickListener(null);
if (pointsDetailsOpened) {
setPreviousMapPosition();
}