Renamed Edit Poi Class to more appropriate names.

This commit is contained in:
GaidamakUA 2015-10-26 12:50:41 +02:00
parent 0063091275
commit 429284992e
11 changed files with 64 additions and 63 deletions

View file

@ -7,7 +7,7 @@
android:background="?attr/spinnerListBackground"
android:clickable="true"
android:orientation="vertical"
tools:context="net.osmand.plus.osmedit.EditPoiFragment">
tools:context="net.osmand.plus.osmedit.EditPoiDialogFragment">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"

View file

@ -1,14 +1,10 @@
package net.osmand.plus.activities;
import java.io.File;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.TimeZone;
import android.content.Context;
import android.os.Build;
import android.support.annotation.DrawableRes;
import android.support.annotation.StringRes;
import net.osmand.IndexConstants;
import net.osmand.map.ITileSource;
@ -19,10 +15,15 @@ import net.osmand.plus.SQLiteTileSource;
import net.osmand.plus.download.ui.LocalIndexesFragment.LoadLocalIndexTask;
import net.osmand.plus.voice.MediaCommandPlayerImpl;
import net.osmand.plus.voice.TTSCommandPlayerImpl;
import android.content.Context;
import android.os.Build;
import android.support.annotation.DrawableRes;
import android.support.annotation.StringRes;
import java.io.File;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.TimeZone;
public class LocalIndexHelper {
@ -89,7 +90,7 @@ public class LocalIndexHelper {
public List<LocalIndexInfo> getLocalIndexData(LoadLocalIndexTask loadTask){
Map<String, String> loadedMaps = app.getResourceManager().getIndexFileNames();
List<LocalIndexInfo> result = new ArrayList<LocalIndexInfo>();
List<LocalIndexInfo> result = new ArrayList<>();
loadObfData(app.getAppPath(IndexConstants.MAPS_PATH), result, false, loadTask, loadedMaps);
loadObfData(app.getAppPath(IndexConstants.ROADS_INDEX_DIR), result, false, loadTask, loadedMaps);
@ -211,8 +212,8 @@ public class LocalIndexHelper {
TILES_DATA(R.string.local_indexes_cat_tile),
SRTM_DATA(R.string.local_indexes_cat_srtm, R.drawable.ic_plugin_srtm),
WIKI_DATA(R.string.local_indexes_cat_wiki, R.drawable.ic_plugin_wikipedia),
TTS_VOICE_DATA(R.string.local_indexes_cat_tts, R.drawable.ic_action_volume_up);
VOICE_DATA(R.string.local_indexes_cat_voice, R.drawable.ic_action_volume_up),
TTS_VOICE_DATA(R.string.local_indexes_cat_tts, R.drawable.ic_action_volume_up),
VOICE_DATA(R.string.local_indexes_cat_voice, R.drawable.ic_action_volume_up);
// AV_DATA(R.string.local_indexes_cat_av);;
@StringRes
@ -220,12 +221,12 @@ public class LocalIndexHelper {
@DrawableRes
private int iconResource;
private LocalIndexType(@StringRes int resId, @DrawableRes int iconResource){
LocalIndexType(@StringRes int resId, @DrawableRes int iconResource){
this.resId = resId;
this.iconResource = iconResource;
}
private LocalIndexType(@StringRes int resId){
LocalIndexType(@StringRes int resId){
this.resId = resId;
this.iconResource = R.drawable.ic_map;
}

View file

@ -41,10 +41,10 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
public class AdvancedDataFragment extends Fragment
implements EditPoiFragment.OnFragmentActivatedListener {
private static final String TAG = "AdvancedDataFragment";
private static final Log LOG = PlatformUtil.getLog(AdvancedDataFragment.class);
public class AdvancedEditPoiFragment extends Fragment
implements EditPoiDialogFragment.OnFragmentActivatedListener {
private static final String TAG = "AdvancedEditPoiFragment";
private static final Log LOG = PlatformUtil.getLog(AdvancedEditPoiFragment.class);
private TagAdapterLinearLayoutHack mAdapter;
private EditPoiData.TagsChangedListener mTagsChangedListener;
@ -134,8 +134,8 @@ public class AdvancedDataFragment extends Fragment
super.onSaveInstanceState(outState);
}
private EditPoiFragment getEditPoiFragment() {
return (EditPoiFragment) getParentFragment();
private EditPoiDialogFragment getEditPoiFragment() {
return (EditPoiDialogFragment) getParentFragment();
}
private EditPoiData getData() {

View file

@ -35,10 +35,9 @@ import net.osmand.util.OpeningHoursParser.BasicOpeningHourRule;
import org.apache.commons.logging.Log;
public class BasicDataFragment extends Fragment
implements EditPoiFragment.OnFragmentActivatedListener {
private static final String TAG = "BasicDataFragment";
private static final Log LOG = PlatformUtil.getLog(BasicDataFragment.class);
public class BasicEditPoiFragment extends Fragment
implements EditPoiDialogFragment.OnFragmentActivatedListener {
private static final Log LOG = PlatformUtil.getLog(BasicEditPoiFragment.class);
private static final String OPENING_HOURS = "opening_hours";
private EditText streetEditText;
private EditText houseNumberEditText;
@ -163,8 +162,8 @@ public class BasicDataFragment extends Fragment
}
private EditPoiFragment getEditPoiFragment() {
return (EditPoiFragment) getParentFragment();
private EditPoiDialogFragment getEditPoiFragment() {
return (EditPoiDialogFragment) getParentFragment();
}
private EditPoiData getData() {

View file

@ -66,9 +66,9 @@ import java.text.MessageFormat;
import java.util.LinkedHashMap;
import java.util.Map;
public class EditPoiFragment extends DialogFragment {
public static final String TAG = "EditPoiFragment";
private static final Log LOG = PlatformUtil.getLog(EditPoiFragment.class);
public class EditPoiDialogFragment extends DialogFragment {
public static final String TAG = "EditPoiDialogFragment";
private static final Log LOG = PlatformUtil.getLog(EditPoiDialogFragment.class);
private static final String KEY_AMENITY_NODE = "key_amenity_node";
private static final String KEY_AMENITY = "key_amenity";
@ -259,7 +259,7 @@ public class EditPoiFragment extends DialogFragment {
@Override
public void onClick(View v) {
FragmentManager fragmentManager = getActivity().getSupportFragmentManager();
fragmentManager.beginTransaction().remove(EditPoiFragment.this).commit();
fragmentManager.beginTransaction().remove(EditPoiDialogFragment.this).commit();
fragmentManager.popBackStack();
}
});
@ -354,7 +354,7 @@ public class EditPoiFragment extends DialogFragment {
}
public static EditPoiFragment createAddPoiInstance(double latitude, double longitude,
public static EditPoiDialogFragment createAddPoiInstance(double latitude, double longitude,
OsmandApplication application) {
Node node = new Node(latitude, longitude, -1);
Amenity amenity;
@ -365,13 +365,13 @@ public class EditPoiFragment extends DialogFragment {
return createInstance(node, amenity);
}
public static EditPoiFragment createInstance(Node node, Amenity amenity) {
EditPoiFragment editPoiFragment = new EditPoiFragment();
public static EditPoiDialogFragment createInstance(Node node, Amenity amenity) {
EditPoiDialogFragment editPoiDialogFragment = new EditPoiDialogFragment();
Bundle args = new Bundle();
args.putSerializable(KEY_AMENITY_NODE, node);
args.putSerializable(KEY_AMENITY, amenity);
editPoiFragment.setArguments(args);
return editPoiFragment;
editPoiDialogFragment.setArguments(args);
return editPoiDialogFragment;
}
public EditPoiData getEditPoiData() {
@ -500,8 +500,8 @@ public class EditPoiFragment extends DialogFragment {
protected void onPostExecute(Node n) {
if (n != null) {
EditPoiFragment fragment =
EditPoiFragment.createInstance(n, amenity);
EditPoiDialogFragment fragment =
EditPoiDialogFragment.createInstance(n, amenity);
fragment.show(activity.getSupportFragmentManager(), TAG);
} else {
AccessibleToast.makeText(activity,
@ -513,8 +513,8 @@ public class EditPoiFragment extends DialogFragment {
}
public static class MyAdapter extends FragmentPagerAdapter {
private final Fragment[] fragments = new Fragment[]{new BasicDataFragment(),
new AdvancedDataFragment()};
private final Fragment[] fragments = new Fragment[]{new BasicEditPoiFragment(),
new AdvancedEditPoiFragment()};
private final String[] titles;
public MyAdapter(FragmentManager fm, String basicTitle, String extendedTitle) {

View file

@ -28,7 +28,6 @@ import net.osmand.plus.activities.EnumAdapter;
import net.osmand.plus.activities.EnumAdapter.IEnumWithResource;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.TabActivity;
import net.osmand.plus.dashboard.DashboardOnMap;
import net.osmand.plus.dashboard.tools.DashFragmentData;
import net.osmand.plus.myplaces.AvailableGPXFragment;
import net.osmand.plus.myplaces.AvailableGPXFragment.GpxInfo;
@ -156,21 +155,21 @@ public class OsmEditingPlugin extends OsmandPlugin {
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int resId, int pos, boolean isChecked) {
if (resId == R.string.context_menu_item_create_poi) {
//getPoiActions(mapActivity).showCreateDialog(latitude, longitude);
EditPoiFragment editPoiFragment =
EditPoiFragment.createAddPoiInstance(latitude, longitude,
EditPoiDialogFragment editPoiDialogFragment =
EditPoiDialogFragment.createAddPoiInstance(latitude, longitude,
mapActivity.getMyApplication());
editPoiFragment.show(mapActivity.getSupportFragmentManager(),
EditPoiFragment.TAG);
editPoiDialogFragment.show(mapActivity.getSupportFragmentManager(),
EditPoiDialogFragment.TAG);
} else if (resId == R.string.context_menu_item_open_bug) {
if (osmBugsLayer == null) {
registerLayers(mapActivity);
}
osmBugsLayer.openBug(latitude, longitude);
} else if (resId == R.string.poi_context_menu_delete) {
new EditPoiFragment.ShowDeleteDialogAsyncTask(mapActivity)
new EditPoiDialogFragment.ShowDeleteDialogAsyncTask(mapActivity)
.execute((Amenity) selectedObj);
} else if (resId == R.string.poi_context_menu_modify) {
EditPoiFragment.showEditInstance((Amenity) selectedObj, mapActivity);
EditPoiDialogFragment.showEditInstance((Amenity) selectedObj, mapActivity);
}
return true;
}
@ -265,7 +264,7 @@ public class OsmEditingPlugin extends OsmandPlugin {
Private(R.string.gpxup_private);
private final int resourceId;
private UploadVisibility(int resourceId) {
UploadVisibility(int resourceId) {
this.resourceId = resourceId;
}
@ -296,7 +295,7 @@ public class OsmEditingPlugin extends OsmandPlugin {
}
final EditText tags = (EditText) view.findViewById(R.id.TagsText);
final Spinner visibility = ((Spinner) view.findViewById(R.id.Visibility));
EnumAdapter<UploadVisibility> adapter = new EnumAdapter<UploadVisibility>(la, android.R.layout.simple_spinner_item, UploadVisibility.values());
EnumAdapter<UploadVisibility> adapter = new EnumAdapter<>(la, android.R.layout.simple_spinner_item, UploadVisibility.values());
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
visibility.setAdapter(adapter);
visibility.setSelection(0);

View file

@ -14,7 +14,7 @@ import net.osmand.osm.edit.Node;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.osmedit.EditPoiFragment;
import net.osmand.plus.osmedit.EditPoiDialogFragment;
import net.osmand.plus.osmedit.OpenstreetmapLocalUtil;
import net.osmand.plus.osmedit.OpenstreetmapUtil;
import net.osmand.plus.osmedit.OsmEditingPlugin;
@ -40,7 +40,7 @@ public class DeletePoiDialogFragment extends DialogFragment {
@Override
public void onClick(DialogInterface dialog, int which) {
Node node = (Node) args.getSerializable(KEY_AMENITY_NODE);
EditPoiFragment.commitNode(OsmPoint.Action.DELETE, node,
EditPoiDialogFragment.commitNode(OsmPoint.Action.DELETE, node,
mOpenstreetmapUtil.getEntityInfo(), null, false,
new Runnable() {
@Override

View file

@ -10,7 +10,7 @@ import android.text.format.DateFormat;
import net.osmand.PlatformUtil;
import net.osmand.plus.R;
import net.osmand.plus.osmedit.BasicDataFragment;
import net.osmand.plus.osmedit.BasicEditPoiFragment;
import net.osmand.util.OpeningHoursParser;
import org.apache.commons.logging.Log;
@ -69,7 +69,7 @@ public class OpeningHoursDaysDialogFragment extends DialogFragment {
OpeningHoursHoursDialogFragment.createInstance(item, positionToAdd, true)
.show(getFragmentManager(), "TimePickerDialogFragment");
} else {
((BasicDataFragment) getParentFragment())
((BasicEditPoiFragment) getParentFragment())
.setBasicOpeningHoursRule(item, positionToAdd);
}
}

View file

@ -14,7 +14,7 @@ import android.widget.TextView;
import android.widget.TimePicker;
import net.osmand.plus.R;
import net.osmand.plus.osmedit.BasicDataFragment;
import net.osmand.plus.osmedit.BasicEditPoiFragment;
import net.osmand.util.OpeningHoursParser;
public class OpeningHoursHoursDialogFragment extends DialogFragment {
@ -63,7 +63,7 @@ public class OpeningHoursHoursDialogFragment extends DialogFragment {
} else {
item.setEndTime(time);
}
((BasicDataFragment) getParentFragment())
((BasicEditPoiFragment) getParentFragment())
.setBasicOpeningHoursRule(item, positionToAdd);
}
}

View file

@ -11,9 +11,10 @@ import net.osmand.data.Amenity;
import net.osmand.osm.MapPoiTypes;
import net.osmand.osm.PoiType;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.osmedit.EditPoiFragment;
import net.osmand.plus.osmedit.EditPoiDialogFragment;
import java.util.Map;
import java.util.Set;
public class PoiSubTypeDialogFragment extends DialogFragment {
private static final String KEY_AMENITY = "amenity";
@ -26,11 +27,12 @@ public class PoiSubTypeDialogFragment extends DialogFragment {
final Amenity a = (Amenity) getArguments().getSerializable(KEY_AMENITY);
final Map<String, PoiType> allTranslatedNames = poiTypes.getAllTranslatedNames(a.getType(), true);
// (=^.^=)
final String[] subCats = allTranslatedNames.keySet().toArray(new String[0]);
Set<String> strings = allTranslatedNames.keySet();
final String[] subCats = strings.toArray(new String[strings.size()]);
builder.setItems(subCats, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
((EditPoiFragment) getParentFragment()).setSubCategory(subCats[which]);
((EditPoiDialogFragment) getParentFragment()).setSubCategory(subCats[which]);
dismiss();
}
});

View file

@ -11,7 +11,7 @@ import net.osmand.data.Amenity;
import net.osmand.osm.MapPoiTypes;
import net.osmand.osm.PoiCategory;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.osmedit.EditPoiFragment;
import net.osmand.plus.osmedit.EditPoiDialogFragment;
import java.util.ArrayList;
import java.util.List;
@ -45,7 +45,7 @@ public class PoiTypeDialogFragment extends DialogFragment {
if (aType != amenity.getType()) {
amenity.setType(aType);
amenity.setSubType(""); //$NON-NLS-1$
((EditPoiFragment) getParentFragment()).updateType(amenity);
((EditPoiDialogFragment) getParentFragment()).updateType(amenity);
}
dismiss();
}