Пример #1
0
 @NonNull
 @Override
 public Dialog onCreateDialog(Bundle savedInstanceState) {
   MapPoiTypes poiTypes = ((OsmandApplication) getActivity().getApplication()).getPoiTypes();
   final Amenity amenity = (Amenity) getArguments().getSerializable(KEY_AMENITY);
   AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
   final List<PoiCategory> categories = poiTypes.getCategories(false);
   ArrayList<String> vals = new ArrayList<>(categories.size());
   ArrayList<PoiCategory> toDelete = new ArrayList<>();
   // TODO replace with constants
   for (PoiCategory category : categories) {
     if (category.getKeyName().equals("user_defined_other")
         || category.getKeyName().equals("osmwiki")) {
       toDelete.add(category);
     } else {
       vals.add(category.getTranslation());
     }
   }
   categories.removeAll(toDelete);
   builder.setItems(
       vals.toArray(new String[vals.size()]),
       new Dialog.OnClickListener() {
         @Override
         public void onClick(DialogInterface dialog, int which) {
           PoiCategory aType = categories.get(which);
           if (aType != amenity.getType()) {
             amenity.setType(aType);
             amenity.setSubType(""); // $NON-NLS-1$
             ((EditPoiDialogFragment) getParentFragment()).updateType(amenity);
           }
           dismiss();
         }
       });
   return builder.create();
 }
Пример #2
0
 public static PoiSubTypeDialogFragment createInstance(PoiCategory cat) {
   PoiSubTypeDialogFragment fragment = new PoiSubTypeDialogFragment();
   Bundle args = new Bundle();
   args.putSerializable(KEY_POI_CATEGORY, cat.getKeyName());
   fragment.setArguments(args);
   return fragment;
 }
Пример #3
0
 @Override
 public String toString() {
   return type.getKeyName() + " : " + subType + " " + getName();
 }
Пример #4
0
 @Override
 public String toStringEn() {
   return super.toStringEn() + ":" + type.getKeyName() + ":" + subType;
 }