Poi dialog design.
This commit is contained in:
parent
61800f7419
commit
1bfc3c2162
12 changed files with 205 additions and 195 deletions
|
@ -1,5 +1,9 @@
|
|||
package net.osmand.data;
|
||||
|
||||
import net.osmand.Location;
|
||||
import net.osmand.osm.PoiCategory;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
|
@ -13,10 +17,6 @@ import java.util.Map;
|
|||
import java.util.Map.Entry;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
||||
import net.osmand.Location;
|
||||
import net.osmand.osm.PoiCategory;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
||||
|
||||
public class Amenity extends MapObject {
|
||||
|
||||
|
@ -28,7 +28,7 @@ public class Amenity extends MapObject {
|
|||
|
||||
private static final long serialVersionUID = 132083949926339552L;
|
||||
private String subType;
|
||||
private PoiCategory type;
|
||||
private transient PoiCategory type;
|
||||
// duplicate for fast access
|
||||
private String openingHours;
|
||||
private Map<String, String> additionalInfo;
|
||||
|
|
|
@ -92,19 +92,19 @@
|
|||
android:text="Open hours"
|
||||
android:textColor="@color/color_black"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/openHoursContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
<ImageView
|
||||
android:id="@+id/openHoursImageView"
|
||||
style="@style/edit_poi_imageview_style"
|
||||
android:layout_below="@id/openHoursTextView"
|
||||
android:orientation="vertical"/>
|
||||
tools:src="@drawable/ic_action_time"/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/openHoursEditText"
|
||||
style="@style/create_poi_text_field"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_below="@id/openHoursTextView"
|
||||
android:hint="Mo-Su 08:00-20:00"
|
||||
android:inputType="textMultiLine"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/addOpeningHoursButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/openHoursContainer"
|
||||
android:layout_marginLeft="72dp"
|
||||
android:text="Add opening hours"/>
|
||||
</RelativeLayout>
|
||||
</android.support.v4.widget.NestedScrollView>
|
|
@ -1,8 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:orientation="vertical">
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_marginLeft="5dp"
|
||||
|
@ -11,7 +11,7 @@
|
|||
android:text="@string/osb_comment_dialog_message" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/BugMessage"
|
||||
android:id="@+id/messageEditText"
|
||||
android:minLines="1"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginRight="5dp"
|
||||
|
@ -27,7 +27,7 @@
|
|||
android:text="@string/osb_comment_dialog_author" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/AuthorName"
|
||||
android:id="@+id/userNameEditText"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -42,12 +42,10 @@
|
|||
android:text="@string/osb_author_dialog_password" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/Password"
|
||||
android:id="@+id/passwordEditText"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="fill_parent"
|
||||
android:inputType="textPassword" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
|
50
OsmAnd/res/layout/send_poi_dialog.xml
Normal file
50
OsmAnd/res/layout/send_poi_dialog.xml
Normal file
|
@ -0,0 +1,50 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:text="@string/osb_comment_dialog_message" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/messageEditText"
|
||||
android:minLines="1"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="fill_parent"
|
||||
android:inputType="textMultiLine" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:text="@string/user_name" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/userNameEditText"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="fill_parent" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:text="@string/user_password" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/passwordEditText"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="fill_parent"
|
||||
android:inputType="textPassword" />
|
||||
</LinearLayout>
|
|
@ -2236,4 +2236,5 @@ Afghanistan, Albania, Algeria, Andorra, Angola, Anguilla, Antigua and Barbuda, A
|
|||
<string name="shared_string_skip">Skip</string>
|
||||
<string name="app_name_osmand">OsmAnd</string>
|
||||
<string name="offline_maps_and_navigation"><![CDATA[Offline Maps\n& Navigation]]></string>
|
||||
<string name="commit_poi">Commit POI</string>
|
||||
</resources>
|
||||
|
|
|
@ -139,7 +139,6 @@ public class AdvancedDataFragment extends Fragment {
|
|||
editPoiData.tags.add(tag);
|
||||
if (mIsUserInput)
|
||||
editPoiData.notifyDatasetChanged(mTagsChangedListener);
|
||||
EditText valueEditText = (EditText) view.findViewById(R.id.valueEditText);
|
||||
linearLayout.addView(view);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,19 +1,24 @@
|
|||
package net.osmand.plus.osmedit;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.ProgressImplementation;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
|
@ -90,7 +95,12 @@ public class DashOsmEditsFragment extends DashBaseFragment {
|
|||
send.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
uploadItem(point);
|
||||
if (point.getGroup() == OsmPoint.Group.POI) {
|
||||
SendPoiDialogFragment.createInstance((OpenstreetmapPoint) point)
|
||||
.show(getChildFragmentManager(), "SendPoiDialogFragment");
|
||||
} else {
|
||||
uploadItem(point);
|
||||
}
|
||||
}
|
||||
});
|
||||
view.findViewById(R.id.options).setVisibility(View.GONE);
|
||||
|
@ -188,4 +198,44 @@ public class DashOsmEditsFragment extends DashBaseFragment {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class SendPoiDialogFragment extends DialogFragment {
|
||||
public static final String OPENSTREETMAP_POINT = "openstreetmap_point";
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
final OpenstreetmapPoint poi = (OpenstreetmapPoint) getArguments().getSerializable(OPENSTREETMAP_POINT);
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||
View view = getActivity().getLayoutInflater().inflate(R.layout.send_poi_dialog, null);
|
||||
final EditText messageEditText = (EditText) view.findViewById(R.id.messageEditText);
|
||||
final EditText userNameEditText = (EditText) view.findViewById(R.id.userNameEditText);
|
||||
final EditText passwordEditText = (EditText) view.findViewById(R.id.passwordEditText);
|
||||
|
||||
final OsmandSettings settings = ((MapActivity) getActivity()).getMyApplication().getSettings();
|
||||
userNameEditText.setText(settings.USER_NAME.get());
|
||||
passwordEditText.setText(settings.USER_PASSWORD.get());
|
||||
builder.setTitle(R.string.commit_poi)
|
||||
.setView(view)
|
||||
.setPositiveButton(R.string.shared_string_ok, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
settings.USER_NAME.set(userNameEditText.getText().toString());
|
||||
settings.USER_PASSWORD.set(passwordEditText.getText().toString());
|
||||
poi.setComment(messageEditText.getText().toString());
|
||||
((DashOsmEditsFragment) getParentFragment()).showProgressDialog(poi);
|
||||
}
|
||||
})
|
||||
.setNegativeButton(R.string.shared_string_cancel, null);
|
||||
return builder.create();
|
||||
}
|
||||
|
||||
public static SendPoiDialogFragment createInstance(OpenstreetmapPoint poi) {
|
||||
SendPoiDialogFragment fragment = new SendPoiDialogFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putSerializable(OPENSTREETMAP_POINT, poi);
|
||||
fragment.setArguments(bundle);
|
||||
return fragment;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -406,6 +406,40 @@ public class EditPoiFragment extends Fragment {
|
|||
});
|
||||
}
|
||||
|
||||
public static void showEditInstance(final Amenity amenity, OsmandSettings settings,
|
||||
final MapActivity mapActivity) {
|
||||
final OpenstreetmapUtil openstreetmapUtilToLoad;
|
||||
if (settings.OFFLINE_EDITION.get() || !settings.isInternetConnectionAvailable(true)) {
|
||||
OsmEditingPlugin plugin = OsmandPlugin.getPlugin(OsmEditingPlugin.class);
|
||||
openstreetmapUtilToLoad = new OpenstreetmapLocalUtil(plugin, mapActivity);
|
||||
} else if(!settings.isInternetConnectionAvailable(true)) {
|
||||
openstreetmapUtilToLoad = new OpenstreetmapRemoteUtil(mapActivity);
|
||||
} else {
|
||||
openstreetmapUtilToLoad = new OpenstreetmapRemoteUtil(mapActivity);
|
||||
}
|
||||
new AsyncTask<Void, Void, Node>() {
|
||||
|
||||
@Override
|
||||
protected Node doInBackground(Void... params) {
|
||||
return openstreetmapUtilToLoad.loadNode((Amenity) amenity);
|
||||
}
|
||||
|
||||
protected void onPostExecute(Node n) {
|
||||
if(n != null){
|
||||
EditPoiFragment fragment =
|
||||
EditPoiFragment.createInstance(n, (Amenity) amenity);
|
||||
mapActivity.getSupportFragmentManager().beginTransaction()
|
||||
.add(fragment, "EditPoiFragment").commit();
|
||||
} else {
|
||||
AccessibleToast.makeText(mapActivity,
|
||||
mapActivity.getString(R.string.poi_error_poi_not_found),
|
||||
Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
};
|
||||
|
||||
}.execute(new Void[0]);
|
||||
}
|
||||
|
||||
public static class MyAdapter extends FragmentPagerAdapter {
|
||||
public MyAdapter(FragmentManager fm) {
|
||||
super(fm);
|
||||
|
|
|
@ -1,26 +1,16 @@
|
|||
package net.osmand.plus.osmedit;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.app.TimePickerDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.text.Editable;
|
||||
import android.text.TextUtils;
|
||||
import android.text.TextWatcher;
|
||||
import android.text.format.DateFormat;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TimePicker;
|
||||
|
||||
import net.osmand.osm.edit.OSMSettings;
|
||||
import net.osmand.plus.IconsCache;
|
||||
|
@ -28,9 +18,7 @@ import net.osmand.plus.R;
|
|||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.osmedit.data.EditPoiData;
|
||||
import net.osmand.plus.osmedit.data.Tag;
|
||||
import net.osmand.util.OpeningHoursParser.BasicOpeningHourRule;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -43,6 +31,7 @@ public class NormalDataFragment extends Fragment {
|
|||
private EditText descriptionEditText;
|
||||
private EditPoiData.TagsChangedListener mTagsChangedListener;
|
||||
private boolean mIsUserInput = true;
|
||||
private EditText openHoursEditText;
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
|
@ -60,6 +49,8 @@ public class NormalDataFragment extends Fragment {
|
|||
webSiteImageView.setImageDrawable(iconsCache.getContentIcon(R.drawable.ic_world_globe_dark));
|
||||
ImageView descriptionImageView = (ImageView) view.findViewById(R.id.descriptionImageView);
|
||||
descriptionImageView.setImageDrawable(iconsCache.getContentIcon(R.drawable.ic_action_description));
|
||||
ImageView openHoursImageView = (ImageView) view.findViewById(R.id.openHoursImageView);
|
||||
openHoursImageView.setImageDrawable(iconsCache.getContentIcon(R.drawable.ic_action_time));
|
||||
|
||||
streetEditText = (EditText) view.findViewById(R.id.streetEditText);
|
||||
streetEditText.addTextChangedListener(new MyOnFocusChangeListener(getData(),
|
||||
|
@ -76,15 +67,10 @@ public class NormalDataFragment extends Fragment {
|
|||
descriptionEditText = (EditText) view.findViewById(R.id.descriptionEditText);
|
||||
descriptionEditText.addTextChangedListener(new MyOnFocusChangeListener(getData(),
|
||||
OSMSettings.OSMTagKey.DESCRIPTION.getValue()));
|
||||
Button addOpeningHoursButton = (Button) view.findViewById(R.id.addOpeningHoursButton);
|
||||
addOpeningHoursButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
BasicOpeningHourRule r = new BasicOpeningHourRule();
|
||||
DaysDialogFragment fragment = DaysDialogFragment.createInstance(r, -1);
|
||||
fragment.show(getChildFragmentManager(), "OpenTimeDialogFragment");
|
||||
}
|
||||
});
|
||||
openHoursEditText = (EditText) view.findViewById(R.id.openHoursEditText);
|
||||
openHoursEditText.addTextChangedListener(new MyOnFocusChangeListener(getData(),
|
||||
OSMSettings.OSMTagKey.OPENING_HOURS.getValue()));
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
|
@ -105,6 +91,8 @@ public class NormalDataFragment extends Fragment {
|
|||
webSiteEditText);
|
||||
tagMapProcessor.addFilter(OSMSettings.OSMTagKey.DESCRIPTION.getValue(),
|
||||
descriptionEditText);
|
||||
tagMapProcessor.addFilter(OSMSettings.OSMTagKey.OPENING_HOURS.getValue(),
|
||||
openHoursEditText);
|
||||
|
||||
mIsUserInput = false;
|
||||
for (Tag tag : getData().tags) {
|
||||
|
@ -184,116 +172,4 @@ public class NormalDataFragment extends Fragment {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class DaysDialogFragment extends DialogFragment {
|
||||
public static final String POSITION_TO_ADD = "position_to_add";
|
||||
public static final String ITEM = "item";
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
Log.v(TAG, "onCreateDialog(" + "savedInstanceState=" + savedInstanceState + ")" + getArguments());
|
||||
final BasicOpeningHourRule item =
|
||||
(BasicOpeningHourRule) getArguments().getSerializable(ITEM);
|
||||
final int positionToAdd = getArguments().getInt(POSITION_TO_ADD);
|
||||
|
||||
AlertDialog.Builder b = new AlertDialog.Builder(getActivity());
|
||||
|
||||
boolean add = positionToAdd > -1;
|
||||
Calendar inst = Calendar.getInstance();
|
||||
final int first = inst.getFirstDayOfWeek();
|
||||
final boolean[] dayToShow = new boolean[7];
|
||||
String[] daysToShow = new String[7];
|
||||
for (int i = 0; i < 7; i++) {
|
||||
int d = (first + i - 1) % 7 + 1;
|
||||
inst.set(Calendar.DAY_OF_WEEK, d);
|
||||
daysToShow[i] = DateFormat.format("EEEE", inst).toString(); //$NON-NLS-1$
|
||||
final int pos = (d + 5) % 7;
|
||||
dayToShow[i] = item.getDays()[pos];
|
||||
}
|
||||
b.setMultiChoiceItems(daysToShow, dayToShow, new DialogInterface.OnMultiChoiceClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which, boolean isChecked) {
|
||||
dayToShow[which] = isChecked;
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
b.setPositiveButton(add ? getActivity().getString(R.string.shared_string_add)
|
||||
: getActivity().getString(R.string.shared_string_apply),
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
boolean[] days = item.getDays();
|
||||
for (int i = 0; i < 7; i++) {
|
||||
days[(first + 5 + i) % 7] = dayToShow[i];
|
||||
}
|
||||
TimePickerDialogFragment.createInstance(null, true)
|
||||
.show(getFragmentManager(), "TimePickerDialogFragment");
|
||||
if (positionToAdd != -1) {
|
||||
|
||||
// time.insert(item, positionToAdd);
|
||||
// selectedRule = positionToAdd;
|
||||
} else {
|
||||
// time.notifyDataSetChanged();
|
||||
}
|
||||
// updateTimePickers();
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
b.setNegativeButton(getActivity().getString(R.string.shared_string_cancel), null);
|
||||
|
||||
return b.create();
|
||||
}
|
||||
|
||||
public static DaysDialogFragment createInstance(final BasicOpeningHourRule item,
|
||||
final int positionToAdd) {
|
||||
DaysDialogFragment daysDialogFragment = new DaysDialogFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putSerializable(ITEM, item);
|
||||
bundle.putInt(POSITION_TO_ADD, positionToAdd);
|
||||
daysDialogFragment.setArguments(bundle);
|
||||
return daysDialogFragment;
|
||||
}
|
||||
}
|
||||
|
||||
public static class TimePickerDialogFragment extends DialogFragment {
|
||||
public static final String INITIAL_TIME = "initial_time";
|
||||
public static final String IS_START = "is_start";
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
Bundle args = getArguments();
|
||||
Calendar initialState = (Calendar) args.getSerializable(INITIAL_TIME);
|
||||
if (initialState == null) initialState = Calendar.getInstance();
|
||||
TimePickerDialog.OnTimeSetListener callback = new TimePickerDialog.OnTimeSetListener() {
|
||||
@Override
|
||||
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
|
||||
TimePickerDialogFragment.createInstance(null, false)
|
||||
.show(getFragmentManager(), "TimePickerDialogFragment");
|
||||
}
|
||||
};
|
||||
TimePickerDialog timePickerDialog = new TimePickerDialog(getActivity(), callback,
|
||||
initialState.get(Calendar.HOUR_OF_DAY),
|
||||
initialState.get(Calendar.MINUTE),
|
||||
DateFormat.is24HourFormat(getActivity()));
|
||||
boolean isStart = args.getBoolean(IS_START);
|
||||
timePickerDialog.setTitle(isStart ? "Opening" : " Closing");
|
||||
return timePickerDialog;
|
||||
}
|
||||
|
||||
public static TimePickerDialogFragment createInstance(Calendar initialTime,
|
||||
boolean isStart) {
|
||||
TimePickerDialogFragment fragment = new TimePickerDialogFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putBoolean(IS_START, isStart);
|
||||
bundle.putSerializable(INITIAL_TIME, initialTime);
|
||||
fragment.setArguments(bundle);
|
||||
return fragment;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ import net.osmand.plus.Version;
|
|||
import net.osmand.util.MapUtils;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
import org.xmlpull.v1.XmlSerializer;
|
||||
|
||||
|
|
|
@ -1,13 +1,20 @@
|
|||
package net.osmand.plus.osmedit;
|
||||
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.Serializable;
|
||||
import java.net.URLConnection;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.AlertDialog.Builder;
|
||||
import android.app.Dialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.PointF;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.util.Xml;
|
||||
import android.view.View;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Toast;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.PlatformUtil;
|
||||
|
@ -33,20 +40,13 @@ import org.apache.commons.logging.Log;
|
|||
import org.xmlpull.v1.XmlPullParser;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.AlertDialog.Builder;
|
||||
import android.app.Dialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.PointF;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.util.Xml;
|
||||
import android.view.View;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Toast;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.Serializable;
|
||||
import java.net.URLConnection;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider, DialogProvider {
|
||||
|
||||
|
@ -333,8 +333,8 @@ public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider
|
|||
}
|
||||
|
||||
private void prepareOpenBugDialog(Dialog dlg, Bundle args) {
|
||||
((EditText)dlg.findViewById(R.id.BugMessage)).setText(args.getString(KEY_MESSAGE));
|
||||
((EditText)dlg.findViewById(R.id.AuthorName)).setText(args.getString(KEY_AUTHOR));
|
||||
((EditText)dlg.findViewById(R.id.messageEditText)).setText(args.getString(KEY_MESSAGE));
|
||||
((EditText)dlg.findViewById(R.id.userNameEditText)).setText(args.getString(KEY_AUTHOR));
|
||||
}
|
||||
|
||||
private Dialog createOpenBugDialog(final Bundle args) {
|
||||
|
@ -343,9 +343,9 @@ public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider
|
|||
builder.setTitle(R.string.osb_add_dialog_title);
|
||||
builder.setView(openBug);
|
||||
builder.setNegativeButton(R.string.shared_string_cancel, null);
|
||||
((EditText)openBug.findViewById(R.id.Password)).setText(((OsmandApplication) activity.getApplication()).getSettings().USER_PASSWORD.get());
|
||||
((EditText)openBug.findViewById(R.id.AuthorName)).setText(getUserName());
|
||||
AndroidUtils.softKeyboardDelayed((EditText)openBug.findViewById(R.id.BugMessage));
|
||||
((EditText)openBug.findViewById(R.id.passwordEditText)).setText(((OsmandApplication) activity.getApplication()).getSettings().USER_PASSWORD.get());
|
||||
((EditText)openBug.findViewById(R.id.userNameEditText)).setText(getUserName());
|
||||
AndroidUtils.softKeyboardDelayed((EditText)openBug.findViewById(R.id.messageEditText));
|
||||
builder.setPositiveButton(R.string.shared_string_add, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
|
@ -426,9 +426,9 @@ public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider
|
|||
builder.setTitle(R.string.osb_comment_dialog_title);
|
||||
final View view = activity.getLayoutInflater().inflate(R.layout.open_bug, null);
|
||||
builder.setView(view);
|
||||
((EditText)view.findViewById(R.id.AuthorName)).setText(getUserName());
|
||||
((EditText)view.findViewById(R.id.Password)).setText(((OsmandApplication) activity.getApplication()).getSettings().USER_PASSWORD.get());
|
||||
AndroidUtils.softKeyboardDelayed((EditText)view.findViewById(R.id.BugMessage));
|
||||
((EditText)view.findViewById(R.id.userNameEditText)).setText(getUserName());
|
||||
((EditText)view.findViewById(R.id.passwordEditText)).setText(((OsmandApplication) activity.getApplication()).getSettings().USER_PASSWORD.get());
|
||||
AndroidUtils.softKeyboardDelayed((EditText)view.findViewById(R.id.messageEditText));
|
||||
builder.setNegativeButton(R.string.shared_string_cancel, null);
|
||||
builder.setPositiveButton(R.string.osb_comment_dialog_add_button, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
|
@ -446,9 +446,9 @@ public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider
|
|||
}
|
||||
|
||||
private String getTextAndUpdateUserPwd(final View view) {
|
||||
String text = ((EditText)view.findViewById(R.id.BugMessage)).getText().toString();
|
||||
String author = ((EditText)view.findViewById(R.id.AuthorName)).getText().toString();
|
||||
String pwd = ((EditText)view.findViewById(R.id.Password)).getText().toString();
|
||||
String text = ((EditText)view.findViewById(R.id.messageEditText)).getText().toString();
|
||||
String author = ((EditText)view.findViewById(R.id.userNameEditText)).getText().toString();
|
||||
String pwd = ((EditText)view.findViewById(R.id.passwordEditText)).getText().toString();
|
||||
((OsmandApplication) OsmBugsLayer.this.activity.getApplication()).getSettings().USER_NAME.set(author);
|
||||
((OsmandApplication) OsmBugsLayer.this.activity.getApplication()).getSettings().USER_PASSWORD.set(pwd);
|
||||
return text;
|
||||
|
@ -583,7 +583,7 @@ public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider
|
|||
public void onPrepareDialog(int id, Dialog dialog) {
|
||||
switch (id) {
|
||||
case DIALOG_COMMENT_BUG:
|
||||
((EditText)dialog.findViewById(R.id.BugMessage)).setText("");
|
||||
((EditText)dialog.findViewById(R.id.messageEditText)).setText("");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -139,7 +139,10 @@ public class OsmEditingPlugin extends OsmandPlugin {
|
|||
// }
|
||||
|
||||
@Override
|
||||
public void registerMapContextMenuActions(final MapActivity mapActivity, final double latitude, final double longitude, ContextMenuAdapter adapter,
|
||||
public void registerMapContextMenuActions(final MapActivity mapActivity,
|
||||
final double latitude,
|
||||
final double longitude,
|
||||
ContextMenuAdapter adapter,
|
||||
final Object selectedObj) {
|
||||
OnContextMenuClick listener = new OnContextMenuClick() {
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue