コード例 #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
ファイル: Amenity.java プロジェクト: fangly/Osmand
 @Override
 public String toString() {
   return type.getKeyName() + " : " + subType + " " + getName();
 }
コード例 #4
0
ファイル: Amenity.java プロジェクト: poretsky/Osmand
 @Override
 public String toStringEn() {
   return super.toStringEn() + ":" + type.getKeyName() + ":" + subType;
 }