This commit is contained in:
Alexey Kulish 2016-11-03 11:45:19 +03:00
parent 79c588a4ea
commit f44f80f004
4 changed files with 63 additions and 44 deletions

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<tools:LinearLayout
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
@ -11,24 +11,24 @@
android:id="@+id/osm_user_name_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginLeft="24dp"
android:layout_marginRight="24dp"
android:text="@string/user_name"/>
<EditText
android:id="@+id/user_name_field"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"/>
android:layout_marginLeft="24dp"
android:layout_marginRight="24dp"/>
<TextView
android:id="@+id/osm_user_password_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginLeft="24dp"
android:layout_marginRight="24dp"
android:text="@string/user_password"/>
<EditText
@ -36,7 +36,7 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginLeft="24dp"
android:layout_marginRight="24dp"
android:inputType="textPassword"/>
</tools:LinearLayout>
</LinearLayout>

View file

@ -4,43 +4,58 @@
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:text="@string/upload_osm_note_description"
android:textSize="@dimen/default_desc_text_size"/>
<LinearLayout
android:id="@+id/osm_note_header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:orientation="horizontal">
android:orientation="vertical">
<TextView
android:layout_width="0dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/upload_anonymously"
android:layout_marginTop="16dp"
android:layout_marginBottom="16dp"
android:layout_marginLeft="24dp"
android:layout_marginRight="24dp"
android:text="@string/upload_osm_note_description"
android:textSize="@dimen/default_desc_text_size"/>
<android.support.v7.widget.SwitchCompat
android:id="@+id/upload_anonymously_switch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginBottom="16dp"
android:layout_marginLeft="24dp"
android:layout_marginRight="24dp"
android:orientation="horizontal">
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/divider_color"/>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/upload_anonymously"
android:textSize="@dimen/default_desc_text_size"/>
<android.support.v7.widget.SwitchCompat
android:id="@+id/upload_anonymously_switch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginBottom="16dp"
android:background="@color/divider_color"/>
</LinearLayout>
<TextView
android:id="@+id/message_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginLeft="24dp"
android:layout_marginRight="24dp"
android:layout_marginTop="16dp"
android:text="@string/osb_comment_dialog_message"/>
@ -48,8 +63,8 @@
android:id="@+id/message_field"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginLeft="24dp"
android:layout_marginRight="24dp"
android:inputType="textMultiLine"
android:minLines="1"/>
@ -57,8 +72,9 @@
android:id="@+id/close_change_set_checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginLeft="24dp"
android:layout_marginRight="24dp"
android:layout_marginBottom="16dp"
android:text="@string/close_changeset"/>
<include layout="@layout/osm_user_login_details"/>

View file

@ -10,6 +10,7 @@
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
-->
<string name="upload_poi">Upload POI</string>
<string name="route_calculation">Route calculation</string>
<string name="gpx_no_tracks_title">You do not have tracks yet</string>
<string name="gpx_no_tracks_title_folder">You may also add tracks to the folder</string>

View file

@ -59,17 +59,19 @@ public class SendPoiDialogFragment extends DialogFragment {
.getSettings();
userNameEditText.setText(settings.USER_NAME.get());
passwordEditText.setText(settings.USER_PASSWORD.get());
boolean hasOsmPOI = false;
boolean hasPoiGroup = false;
assert poi != null;
for (OsmPoint p : poi) {
if (p.getGroup() == OsmPoint.Group.POI) {
hasOsmPOI = true;
hasPoiGroup = true;
break;
}
}
messageLabel.setVisibility(hasOsmPOI ? View.VISIBLE : View.GONE);
messageEditText.setVisibility(hasOsmPOI ? View.VISIBLE : View.GONE);
closeChangeSetCheckBox.setVisibility(hasOsmPOI ? View.VISIBLE : View.GONE);
final boolean hasPOI = hasPoiGroup;
messageLabel.setVisibility(hasPOI ? View.VISIBLE : View.GONE);
messageEditText.setVisibility(hasPOI ? View.VISIBLE : View.GONE);
closeChangeSetCheckBox.setVisibility(hasPOI ? View.VISIBLE : View.GONE);
view.findViewById(R.id.osm_note_header).setVisibility(hasPOI ? View.GONE : View.VISIBLE);
uploadAnonymously.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
@ -87,7 +89,7 @@ public class SendPoiDialogFragment extends DialogFragment {
progressDialogPoiUploader = (ProgressDialogPoiUploader) getParentFragment();
}
builder.setTitle(R.string.upload_osm_note)
builder.setTitle(hasPOI ? R.string.upload_poi : R.string.upload_osm_note)
.setView(view)
.setPositiveButton(R.string.shared_string_ok, new DialogInterface.OnClickListener() {
@Override
@ -105,7 +107,7 @@ public class SendPoiDialogFragment extends DialogFragment {
}
progressDialogPoiUploader.showProgressDialog(poi,
closeChangeSetCheckBox.isChecked(),
uploadAnonymously.isChecked());
!hasPOI && uploadAnonymously.isChecked());
}
})
.setNegativeButton(R.string.shared_string_cancel, null);