Rename keyboard item layout; delete unnecessary fields

This commit is contained in:
Alexander Sytnyk 2018-02-14 13:01:51 +02:00
parent bfa4d1d497
commit 516be4b8e2
3 changed files with 6 additions and 10 deletions

View file

@ -50,7 +50,6 @@ import net.osmand.AndroidUtils;
import net.osmand.Location; import net.osmand.Location;
import net.osmand.data.LatLon; import net.osmand.data.LatLon;
import net.osmand.data.PointDescription; import net.osmand.data.PointDescription;
import net.osmand.plus.MapMarkersHelper;
import net.osmand.plus.MapMarkersHelper.MapMarker; import net.osmand.plus.MapMarkersHelper.MapMarker;
import net.osmand.plus.OsmAndLocationProvider.OsmAndCompassListener; import net.osmand.plus.OsmAndLocationProvider.OsmAndCompassListener;
import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener; import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener;
@ -92,7 +91,6 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
private static final String NAME_LABEL = "name"; private static final String NAME_LABEL = "name";
private List<MapMarker> mapMarkers = new ArrayList<>(); private List<MapMarker> mapMarkers = new ArrayList<>();
private MapMarkersHelper mapMarkersHelper;
private OnMapMarkersSavedListener listener; private OnMapMarkersSavedListener listener;
private View mainView; private View mainView;
@ -147,9 +145,7 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
@Nullable @Nullable
@Override @Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
final MapActivity mapActivity = getMapActivity(); orientationPortrait = AndroidUiHelper.isOrientationPortrait(getActivity());
mapMarkersHelper = getMyApplication().getMapMarkersHelper();
orientationPortrait = AndroidUiHelper.isOrientationPortrait(mapActivity);
Fragment optionsFragment = getChildFragmentManager().findFragmentByTag(CoordinateInputBottomSheetDialogFragment.TAG); Fragment optionsFragment = getChildFragmentManager().findFragmentByTag(CoordinateInputBottomSheetDialogFragment.TAG);
if (optionsFragment != null) { if (optionsFragment != null) {
@ -201,7 +197,7 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
View.OnClickListener backspaceOnClickListener = new View.OnClickListener() { View.OnClickListener backspaceOnClickListener = new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
Toast.makeText(mapActivity, "backspace", Toast.LENGTH_SHORT).show(); Toast.makeText(getContext(), "backspace", Toast.LENGTH_SHORT).show();
} }
}; };
@ -211,7 +207,7 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
latSideOfTheWorldBtn.setOnClickListener(new View.OnClickListener() { latSideOfTheWorldBtn.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
Toast.makeText(mapActivity, "lat side of the world", Toast.LENGTH_SHORT).show(); Toast.makeText(getContext(), "lat side of the world", Toast.LENGTH_SHORT).show();
} }
}); });
((TextView) latSideOfTheWorldBtn.findViewById(R.id.lat_side_of_the_world_tv)).setText(getString(R.string.north_abbreviation)); ((TextView) latSideOfTheWorldBtn.findViewById(R.id.lat_side_of_the_world_tv)).setText(getString(R.string.north_abbreviation));
@ -224,7 +220,7 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
lonSideOfTheWorldBtn.setOnClickListener(new View.OnClickListener() { lonSideOfTheWorldBtn.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
Toast.makeText(mapActivity, "lon side of the world", Toast.LENGTH_SHORT).show(); Toast.makeText(getContext(), "lon side of the world", Toast.LENGTH_SHORT).show();
} }
}); });
((TextView) lonSideOfTheWorldBtn.findViewById(R.id.lon_side_of_the_world_tv)).setText(getString(R.string.west_abbreviation)); ((TextView) lonSideOfTheWorldBtn.findViewById(R.id.lon_side_of_the_world_tv)).setText(getString(R.string.west_abbreviation));
@ -411,7 +407,7 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
} }
private void saveMarkers() { private void saveMarkers() {
mapMarkersHelper.addMarkers(mapMarkers); getMyApplication().getMapMarkersHelper().addMarkers(mapMarkers);
if (listener != null) { if (listener != null) {
listener.onMapMarkersSaved(); listener.onMapMarkersSaved();
} }
@ -818,7 +814,7 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
@Override @Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) { public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
if (convertView == null) { if (convertView == null) {
convertView = LayoutInflater.from(getContext()).inflate(R.layout.input_coordinate_keyboard_item, parent, false); convertView = LayoutInflater.from(getContext()).inflate(R.layout.coordinate_input_keyboard_item, parent, false);
} }
if (!orientationPortrait) { if (!orientationPortrait) {
int keyboardViewHeight = mainView.findViewById(R.id.keyboard_grid_view).getMeasuredHeight(); int keyboardViewHeight = mainView.findViewById(R.id.keyboard_grid_view).getMeasuredHeight();