Fix signature and return value of createMenuItems method

This commit is contained in:
Alexander Sytnyk 2018-03-02 14:20:51 +02:00
parent 3f2c1f7a6f
commit 38c71bb5f7
18 changed files with 19 additions and 89 deletions

View file

@ -1,9 +1,7 @@
package net.osmand.plus.audionotes;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import net.osmand.plus.R;
import net.osmand.plus.audionotes.AudioVideoNotesPlugin.Recording;
@ -31,7 +29,7 @@ public class ItemMenuBottomSheetDialogFragment extends MenuBottomSheetDialogFrag
}
@Override
public View createMenuItems(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
public void createMenuItems(Bundle savedInstanceState) {
if (recording != null) {
items.add(new TitleItem(recording.getName(getContext(), true)));
@ -118,8 +116,6 @@ public class ItemMenuBottomSheetDialogFragment extends MenuBottomSheetDialogFrag
.create();
items.add(deleteItem);
}
return null;
}
@Override

View file

@ -1,9 +1,7 @@
package net.osmand.plus.audionotes;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.OsmandSettings.NotesSortByMode;
@ -24,7 +22,7 @@ public class SortByMenuBottomSheetDialogFragment extends MenuBottomSheetDialogFr
}
@Override
public View createMenuItems(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
public void createMenuItems(Bundle savedInstanceState) {
items.add(new TitleItem(getString(R.string.shared_string_sort)));
BaseBottomSheetItem byTypeItem = new SimpleBottomSheetItem.Builder()
@ -52,8 +50,6 @@ public class SortByMenuBottomSheetDialogFragment extends MenuBottomSheetDialogFr
})
.create();
items.add(byDateItem);
return null;
}
private void selectSortByMode(NotesSortByMode mode) {

View file

@ -55,10 +55,7 @@ public abstract class MenuBottomSheetDialogFragment extends BottomSheetDialogFra
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) {
View view = createMenuItems(inflater, parent, savedInstanceState);
if (view != null) {
return view;
}
createMenuItems(savedInstanceState);
OsmandApplication app = getMyApplication();
final int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
@ -115,8 +112,7 @@ public abstract class MenuBottomSheetDialogFragment extends BottomSheetDialogFra
}
}
// inflater, parent and return value are temporary and will be deleted
public abstract View createMenuItems(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState);
public abstract void createMenuItems(Bundle savedInstanceState);
@Override
protected Drawable getContentIcon(@DrawableRes int id) {

View file

@ -8,9 +8,7 @@ import android.graphics.drawable.LayerDrawable;
import android.os.Bundle;
import android.support.annotation.DrawableRes;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import net.osmand.data.LatLon;
import net.osmand.data.PointDescription;
@ -32,7 +30,7 @@ public class AddWaypointBottomSheetDialogFragment extends MenuBottomSheetDialogF
public static final String POINT_DESCRIPTION_KEY = "point_description";
@Override
public View createMenuItems(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
public void createMenuItems(Bundle savedInstanceState) {
Bundle args = getArguments();
final LatLon latLon = new LatLon(args.getDouble(LAT_KEY), args.getDouble(LON_KEY));
final PointDescription name = PointDescription.deserializeFromString(args.getString(POINT_DESCRIPTION_KEY), latLon);
@ -128,8 +126,6 @@ public class AddWaypointBottomSheetDialogFragment extends MenuBottomSheetDialogF
})
.create();
items.add(lastIntermItem);
return null;
}
@Override

View file

@ -746,7 +746,7 @@ public class ImportHelper {
}
@Override
public View createMenuItems(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
public void createMenuItems(Bundle savedInstanceState) {
items.add(new TitleItem(getString(R.string.import_file)));
int nameColor = getResolvedColor(nightMode ? R.color.osmand_orange : R.color.dashboard_blue);
@ -787,8 +787,6 @@ public class ImportHelper {
})
.create();
items.add(asGpxItem);
return null;
}
@ColorInt

View file

@ -1,9 +1,7 @@
package net.osmand.plus.mapcontextmenu.other;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
@ -28,7 +26,7 @@ public class ShareMenuFragment extends MenuBottomSheetDialogFragment {
}
@Override
public View createMenuItems(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
public void createMenuItems(Bundle savedInstanceState) {
items.add(new TitleItem(getString(R.string.share_menu_location)));
View.OnClickListener itemOnClickListener = new View.OnClickListener() {
@ -49,8 +47,6 @@ public class ShareMenuFragment extends MenuBottomSheetDialogFragment {
.create();
items.add(item);
}
return null;
}
@Override

View file

@ -5,9 +5,7 @@ import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import net.osmand.plus.MapMarkersHelper;
import net.osmand.plus.MapMarkersHelper.MarkersSyncGroup;
@ -36,7 +34,7 @@ public abstract class AddGroupBottomSheetDialogFragment extends MenuBottomSheetD
}
@Override
public View createMenuItems(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
public void createMenuItems(Bundle savedInstanceState) {
final int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
mainView = View.inflate(new ContextThemeWrapper(getContext(), themeRes),
R.layout.fragment_marker_add_group_bottom_sheet_dialog, null);
@ -68,8 +66,6 @@ public abstract class AddGroupBottomSheetDialogFragment extends MenuBottomSheetD
recyclerView.setAdapter(adapter);
items.add(new BaseBottomSheetItem.Builder().setCustomView(mainView).create());
return null;
}
@Override

View file

@ -7,9 +7,7 @@ import android.os.Bundle;
import android.support.annotation.ColorRes;
import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
@ -51,7 +49,7 @@ public class CoordinateInputBottomSheetDialogFragment extends MenuBottomSheetDia
}
@Override
public View createMenuItems(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
public void createMenuItems(Bundle savedInstanceState) {
final Context context = getContext();
final OsmandSettings settings = getMyApplication().getSettings();
@ -135,8 +133,6 @@ public class CoordinateInputBottomSheetDialogFragment extends MenuBottomSheetDia
.create();
items.add(formatItem);
}
return null;
}
@Override

View file

@ -1,9 +1,7 @@
package net.osmand.plus.mapmarkers;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import net.osmand.plus.MapMarkersHelper.MapMarker;
import net.osmand.plus.R;
@ -34,7 +32,7 @@ public class HistoryMarkerMenuBottomSheetDialogFragment extends MenuBottomSheetD
}
@Override
public View createMenuItems(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
public void createMenuItems(Bundle savedInstanceState) {
Bundle arguments = getArguments();
if (arguments != null) {
@ -91,8 +89,6 @@ public class HistoryMarkerMenuBottomSheetDialogFragment extends MenuBottomSheetD
.create();
items.add(deleteItem);
}
return null;
}
@Override

View file

@ -2,9 +2,7 @@ package net.osmand.plus.mapmarkers;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import net.osmand.plus.MapMarkersHelper;
import net.osmand.plus.MapMarkersHelper.MapMarkersSortByDef;
@ -26,7 +24,7 @@ public class OrderByBottomSheetDialogFragment extends MenuBottomSheetDialogFragm
}
@Override
public View createMenuItems(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
public void createMenuItems(Bundle savedInstanceState) {
Drawable distanceIcon = getContentIcon(R.drawable.ic_action_markers_dark);
Drawable dateIcon = getContentIcon(R.drawable.ic_action_sort_by_date);
@ -115,8 +113,6 @@ public class OrderByBottomSheetDialogFragment extends MenuBottomSheetDialogFragm
})
.create();
items.add(dateDescItem);
return null;
}
@Override

View file

@ -1,9 +1,7 @@
package net.osmand.plus.mapmarkers;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import net.osmand.plus.R;
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
@ -28,7 +26,7 @@ public class PlanRouteOptionsBottomSheetDialogFragment extends MenuBottomSheetDi
}
@Override
public View createMenuItems(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
public void createMenuItems(Bundle savedInstanceState) {
items.add(new TitleItem(getString(R.string.shared_string_options)));
if (!AndroidUiHelper.isOrientationPortrait(getActivity())) {
@ -120,8 +118,6 @@ public class PlanRouteOptionsBottomSheetDialogFragment extends MenuBottomSheetDi
})
.create();
items.add(reversItem);
return null;
}
@Override

View file

@ -1,9 +1,7 @@
package net.osmand.plus.mapmarkers;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import net.osmand.plus.R;
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
@ -23,7 +21,7 @@ public class SelectionMarkersGroupBottomSheetDialogFragment extends MenuBottomSh
}
@Override
public View createMenuItems(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
public void createMenuItems(Bundle savedInstanceState) {
items.add(new TitleItem(getString(R.string.add_group)));
items.add(new DescriptionItem(getString(R.string.add_group_descr)));
@ -59,8 +57,6 @@ public class SelectionMarkersGroupBottomSheetDialogFragment extends MenuBottomSh
})
.create();
items.add(waypointsItem);
return null;
}
@Override

View file

@ -1,9 +1,7 @@
package net.osmand.plus.measurementtool;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import net.osmand.plus.R;
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
@ -27,7 +25,7 @@ public class OptionsBottomSheetDialogFragment extends MenuBottomSheetDialogFragm
}
@Override
public View createMenuItems(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
public void createMenuItems(Bundle savedInstanceState) {
Bundle args = getArguments();
boolean snapToRoadEnabled = args.getBoolean(SNAP_TO_ROAD_ENABLED_KEY);
boolean addLineMode = args.getBoolean(ADD_LINE_MODE_KEY);
@ -123,8 +121,6 @@ public class OptionsBottomSheetDialogFragment extends MenuBottomSheetDialogFragm
})
.create();
items.add(clearAllItem);
return null;
}
@Override

View file

@ -3,10 +3,8 @@ package net.osmand.plus.measurementtool;
import android.os.Build;
import android.os.Bundle;
import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import net.osmand.plus.R;
@ -27,7 +25,7 @@ public class SaveAsNewTrackBottomSheetDialogFragment extends MenuBottomSheetDial
}
@Override
public View createMenuItems(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
public void createMenuItems(Bundle savedInstanceState) {
items.add(new TitleItem(getString(R.string.shared_string_save_as_gpx)));
items.add(new DescriptionItem(getString(R.string.measurement_tool_save_as_new_track_descr)));
@ -75,8 +73,6 @@ public class SaveAsNewTrackBottomSheetDialogFragment extends MenuBottomSheetDial
.setOnClickListener(saveAsLineOnClickListener)
.create();
items.add(saveAsLineItem);
return null;
}
private View.OnClickListener saveAsLineOnClickListener = new View.OnClickListener() {

View file

@ -6,9 +6,7 @@ import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import net.osmand.plus.GPXUtilities.WptPt;
import net.osmand.plus.OsmAndFormatter;
@ -36,7 +34,7 @@ public class SelectedPointBottomSheetDialogFragment extends MenuBottomSheetDialo
}
@Override
public View createMenuItems(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
public void createMenuItems(Bundle savedInstanceState) {
BaseBottomSheetItem titleItem = new BottomSheetItemWithDescription.Builder()
.setDescription(getDescription())
.setIcon(getActiveIcon(R.drawable.ic_action_measure_point))
@ -112,8 +110,6 @@ public class SelectedPointBottomSheetDialogFragment extends MenuBottomSheetDialo
})
.create();
items.add(addBeforeItem);
return null;
}
@Override

View file

@ -1,9 +1,7 @@
package net.osmand.plus.osmedit;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import net.osmand.plus.R;
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
@ -29,7 +27,7 @@ public class ExportOptionsBottomSheetDialogFragment extends MenuBottomSheetDialo
}
@Override
public View createMenuItems(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
public void createMenuItems(Bundle savedInstanceState) {
Bundle args = getArguments();
if (args != null) {
poiCount = args.getInt(POI_COUNT_KEY);
@ -93,8 +91,6 @@ public class ExportOptionsBottomSheetDialogFragment extends MenuBottomSheetDialo
})
.create();
items.add(allDataItem);
return null;
}
public interface ExportOptionsFragmentListener {

View file

@ -2,9 +2,7 @@ package net.osmand.plus.osmedit;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import net.osmand.plus.R;
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
@ -25,7 +23,7 @@ public class FileTypeBottomSheetDialogFragment extends MenuBottomSheetDialogFrag
}
@Override
public View createMenuItems(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
public void createMenuItems(Bundle savedInstanceState) {
items.add(new TitleItem(getString(R.string.choose_file_type)));
Drawable fileIcon = getContentIcon(R.drawable.ic_type_file);
@ -65,8 +63,6 @@ public class FileTypeBottomSheetDialogFragment extends MenuBottomSheetDialogFrag
})
.create();
items.add(gpxItem);
return null;
}
public interface FileTypeFragmentListener {

View file

@ -1,9 +1,7 @@
package net.osmand.plus.osmedit;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import net.osmand.plus.R;
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
@ -25,7 +23,7 @@ public class OsmEditOptionsBottomSheetDialogFragment extends MenuBottomSheetDial
}
@Override
public View createMenuItems(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
public void createMenuItems(Bundle savedInstanceState) {
Bundle args = getArguments();
if (args != null) {
final OsmPoint osmPoint = (OsmPoint) args.getSerializable(OSM_POINT);
@ -118,8 +116,6 @@ public class OsmEditOptionsBottomSheetDialogFragment extends MenuBottomSheetDial
.create();
items.add(deleteItem);
}
return null;
}
@Override