Adding phone and website options to edit POI

This commit is contained in:
Sander Deryckere 2012-08-09 11:03:35 +02:00
parent 46bca3b1bb
commit acec83df92
3 changed files with 76 additions and 3 deletions

View file

@ -4,24 +4,79 @@
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent"> android:layout_height="fill_parent">
<LinearLayout android:layout_width="fill_parent" <LinearLayout android:layout_width="fill_parent"
android:layout_height="fill_parent" android:orientation="vertical"> android:layout_height="wrap_content" android:orientation="vertical">
<TextView android:text="@string/create_poi_link_to_osm_doc" android:id="@+id/LinkToOsmDoc" android:layout_marginLeft="5dp" android:layout_width="fill_parent" android:layout_height="wrap_content"/> <TextView android:text="@string/create_poi_link_to_osm_doc" android:id="@+id/LinkToOsmDoc" android:layout_marginLeft="5dp" android:layout_width="fill_parent" android:layout_height="wrap_content"/>
<TableLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:stretchColumns="1"> <TableLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:stretchColumns="1">
<TableRow> <TableRow>
<TextView android:text="@string/poi_dialog_name" android:id="@+id/TextView" android:layout_marginLeft="5dp" android:layout_width="wrap_content" android:layout_height="wrap_content"/> <TextView android:text="@string/poi_dialog_name" android:id="@+id/TextView" android:layout_marginLeft="5dp" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
<!-- bug with width set it to 100 --> <!-- bug with width set it to 100 -->
<EditText android:text="" android:id="@+id/Name" android:layout_marginLeft="5dp" android:layout_marginRight="5dp" android:layout_height="wrap_content" android:layout_width ="100dp"></EditText> <EditText android:text="" android:id="@+id/Name" android:layout_marginLeft="5dp" android:layout_marginRight="5dp" android:layout_height="wrap_content" android:layout_width ="100dp"></EditText>
</TableRow> </TableRow>
<TableRow> <TableRow>
<Button android:text="&lt;Type&gt;" android:id="@+id/TypeButton" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
<Button android:text="&lt;Type&gt;" android:id="@+id/TypeButton" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
<AutoCompleteTextView <AutoCompleteTextView
android:text="" android:id="@+id/Type" android:layout_marginLeft="5dp" android:layout_marginRight="5dp" android:layout_height="wrap_content" android:layout_width ="fill_parent"/> android:text="" android:id="@+id/Type" android:layout_marginLeft="5dp" android:layout_marginRight="5dp" android:layout_height="wrap_content" android:layout_width ="fill_parent"/>
<!-- <EditText android:text="" android:id="@+id/Type" android:layout_marginLeft="5dp" android:layout_marginRight="5dp" android:layout_height="wrap_content" android:layout_width = "fill_parent" /> --> <!-- <EditText android:text="" android:id="@+id/Type" android:layout_marginLeft="5dp" android:layout_marginRight="5dp" android:layout_height="wrap_content" android:layout_width = "fill_parent" /> -->
</TableRow> </TableRow>
<TableRow> <TableRow>
<Button android:text="@string/poi_dialog_opening_hours" android:id="@+id/OpenHoursButton" android:layout_width="wrap_content" android:layout_height="wrap_content"/> <Button android:text="@string/poi_dialog_opening_hours" android:id="@+id/OpenHoursButton" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
<EditText android:text="" android:hint="Mo-Su 08:00-20:00" android:id="@+id/OpeningHours" android:layout_marginLeft="5dp" android:layout_marginRight="5dp" android:layout_width ="100dp" android:layout_height="wrap_content"></EditText> <EditText android:text="" android:hint="Mo-Su 08:00-20:00" android:id="@+id/OpeningHours" android:layout_marginLeft="5dp" android:layout_marginRight="5dp" android:layout_width ="100dp" android:layout_height="wrap_content"></EditText>
</TableRow> </TableRow>
<TableRow>
<TextView
android:id="@+id/TextView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text="@string/phone" />
<EditText
android:id="@+id/Phone"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:hint="0123456789"
android:inputType="phone" >
<requestFocus />
</EditText>
</TableRow>
<TableRow>
<TextView
android:id="@+id/TextView02"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text="@string/website" />
<EditText
android:id="@+id/Website"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:hint="http://osmand.net" />
</TableRow>
<TableRow> <TableRow>
<TextView android:text="@string/poi_dialog_comment" android:id="@+id/TextView" android:layout_marginLeft="5dp" android:layout_width="wrap_content" android:layout_height="wrap_content"/> <TextView android:text="@string/poi_dialog_comment" android:id="@+id/TextView" android:layout_marginLeft="5dp" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
<EditText android:text="@string/poi_dialog_comment_default" android:id="@+id/Comment" android:layout_marginLeft="5dp" android:layout_width ="100dp" android:layout_marginRight="5dp" android:layout_height="wrap_content"></EditText> <EditText android:text="@string/poi_dialog_comment_default" android:id="@+id/Comment" android:layout_marginLeft="5dp" android:layout_width ="100dp" android:layout_marginRight="5dp" android:layout_height="wrap_content"></EditText>

View file

@ -1122,4 +1122,5 @@ You can enable (online or cached) tile map sources, tracking settings, and many
<string name="edit_filter_delete_message">Filter {0} has been deleted</string> <string name="edit_filter_delete_message">Filter {0} has been deleted</string>
<string name="edit_filter_create_message">Filter {0} has been created</string> <string name="edit_filter_create_message">Filter {0} has been created</string>
<string name="default_buttons_selectall">Select All</string> <string name="default_buttons_selectall">Select All</string>
</resources>
<string name="email">email</string></resources>

View file

@ -56,6 +56,8 @@ public class EditingPOIActivity implements DialogProvider {
private Button openHoursButton; private Button openHoursButton;
private EditText openingHours; private EditText openingHours;
private EditText commentText; private EditText commentText;
private EditText websiteText;
private EditText phoneText;
// private final static Log log = LogUtil.getLog(EditingPOIActivity.class); // private final static Log log = LogUtil.getLog(EditingPOIActivity.class);
@ -157,6 +159,10 @@ public class EditingPOIActivity implements DialogProvider {
nameText.setText(a.getName()); nameText.setText(a.getName());
EditText openingHours = ((EditText)dlg.findViewById(R.id.OpeningHours)); EditText openingHours = ((EditText)dlg.findViewById(R.id.OpeningHours));
openingHours.setText(a.getOpeningHours()); openingHours.setText(a.getOpeningHours());
EditText phoneText = ((EditText)dlg.findViewById(R.id.Phone));
phoneText.setText(a.getPhone());
EditText websiteText = ((EditText)dlg.findViewById(R.id.Website));
websiteText.setText(a.getSite());
updateType(a); updateType(a);
} }
@ -171,6 +177,9 @@ public class EditingPOIActivity implements DialogProvider {
typeText = ((AutoCompleteTextView)dlg.findViewById(R.id.Type)); typeText = ((AutoCompleteTextView)dlg.findViewById(R.id.Type));
typeText.setThreshold(1); typeText.setThreshold(1);
commentText = ((EditText)dlg.findViewById(R.id.Comment)); commentText = ((EditText)dlg.findViewById(R.id.Comment));
phoneText = ((EditText)dlg.findViewById(R.id.Phone));
websiteText = ((EditText)dlg.findViewById(R.id.Website));
TextView linkToOsmDoc = (TextView) dlg.findViewById(R.id.LinkToOsmDoc); TextView linkToOsmDoc = (TextView) dlg.findViewById(R.id.LinkToOsmDoc);
linkToOsmDoc.setOnClickListener(new View.OnClickListener() { linkToOsmDoc.setOnClickListener(new View.OnClickListener() {
@ -281,6 +290,14 @@ public class EditingPOIActivity implements DialogProvider {
} else { } else {
n.putTag(OSMTagKey.OPENING_HOURS.getValue(), openingHours.getText().toString()); n.putTag(OSMTagKey.OPENING_HOURS.getValue(), openingHours.getText().toString());
} }
String website = websiteText.getText().toString();
if (website.length() > 0 ){
n.putTag(OSMTagKey.WEBSITE.getValue(),website);
}
String phone = phoneText.getText().toString();
if (phone.length() > 0 ){
n.putTag(OSMTagKey.PHONE.getValue(),phone);
}
commitNode(action, n, openstreetmapUtil.getEntityInfo(), commentText.getText().toString(), new Runnable() { commitNode(action, n, openstreetmapUtil.getEntityInfo(), commentText.getText().toString(), new Runnable() {
@Override @Override
public void run() { public void run() {