init
This commit is contained in:
parent
bba9a860e6
commit
c3d88ab231
7 changed files with 473 additions and 2 deletions
6
OsmAnd/res/drawable/layout_bg.xml
Normal file
6
OsmAnd/res/drawable/layout_bg.xml
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<stroke android:width="1dp" android:color="#F0F0F0" />
|
||||
<corners android:radius="6dp"/>
|
||||
<padding android:left="0dp" android:top="0dp" android:right="0dp" android:bottom="0dp" />
|
||||
</shape>
|
116
OsmAnd/res/layout/send_osm_note_fragment.xml
Normal file
116
OsmAnd/res/layout/send_osm_note_fragment.xml
Normal file
|
@ -0,0 +1,116 @@
|
|||
<?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"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="@dimen/content_padding"
|
||||
android:paddingLeft="@dimen/content_padding"
|
||||
android:paddingTop="@dimen/bottom_sheet_content_margin"
|
||||
android:paddingEnd="@dimen/content_padding"
|
||||
android:paddingRight="@dimen/content_padding">
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
android:text = "@string/osm_notes" />
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/message_label"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/bottom_sheet_content_margin"
|
||||
android:hint="@string/osn_bug_name">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/message_field"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:imeOptions="actionDone" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<com.google.android.material.switchmaterial.SwitchMaterial
|
||||
android:id="@+id/upload_anonymously_switch"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="@dimen/context_menu_buttons_bottom_height"
|
||||
android:text="@string/upload_anonymously"
|
||||
android:layout_marginBottom="@dimen/bottom_sheet_content_margin"
|
||||
android:paddingLeft="@dimen/context_menu_padding_margin_medium"
|
||||
android:background="@drawable/layout_bg"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?attr/dashboard_divider" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/account_block"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="@dimen/context_menu_buttons_bottom_height"
|
||||
tools:background="?android:attr/selectableItemBackground">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@android:id/icon"
|
||||
android:layout_width="@dimen/standard_icon_size"
|
||||
android:layout_height="@dimen/standard_icon_size"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginLeft="@dimen/content_padding"
|
||||
android:layout_marginTop="@dimen/bottom_sheet_icon_margin"
|
||||
android:layout_marginRight="@dimen/content_padding"
|
||||
android:layout_marginBottom="@dimen/bottom_sheet_icon_margin"
|
||||
osmand:srcCompat="@drawable/ic_action_user_account"
|
||||
android:tint="@color/active_buttons_and_links_text_disabled_light"
|
||||
android:layout_marginEnd="@dimen/content_padding"
|
||||
android:layout_marginStart="@dimen/content_padding" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="@dimen/content_padding"
|
||||
android:paddingRight="@dimen/content_padding"
|
||||
android:paddingStart="@dimen/content_padding"
|
||||
android:paddingEnd="@dimen/content_padding">
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/account_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="marquee"
|
||||
android:letterSpacing="@dimen/text_button_letter_spacing"
|
||||
android:singleLine="true"
|
||||
android:text="@string/login_account"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
osmand:typeface="@string/font_roboto_regular" />
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/user_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:letterSpacing="@dimen/description_letter_spacing"
|
||||
android:maxLines="4"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
osmand:typeface="@string/font_roboto_regular" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
117
OsmAnd/res/layout/send_poi_fragment.xml
Normal file
117
OsmAnd/res/layout/send_poi_fragment.xml
Normal file
|
@ -0,0 +1,117 @@
|
|||
<?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"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="@dimen/content_padding"
|
||||
android:paddingLeft="@dimen/content_padding"
|
||||
android:paddingTop="@dimen/bottom_sheet_content_margin"
|
||||
android:paddingEnd="@dimen/content_padding"
|
||||
android:paddingRight="@dimen/content_padding">
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:text="@string/upload_poi"
|
||||
android:textSize="@dimen/default_desc_text_size" />
|
||||
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/message_label"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/bottom_sheet_content_margin"
|
||||
android:hint="@string/shared_string_message">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/message_field"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:imeOptions="actionDone" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<com.google.android.material.switchmaterial.SwitchMaterial
|
||||
android:id="@+id/close_change_set_checkbox"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/content_padding"
|
||||
android:minHeight="@dimen/context_menu_buttons_bottom_height"
|
||||
android:text="@string/close_changset"
|
||||
android:paddingLeft="@dimen/context_menu_padding_margin_medium"
|
||||
android:background="@drawable/layout_bg"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?attr/dashboard_divider" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/account_block"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="@dimen/context_menu_buttons_bottom_height"
|
||||
tools:background="?android:attr/selectableItemBackground">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@android:id/icon"
|
||||
android:layout_width="@dimen/standard_icon_size"
|
||||
android:layout_height="@dimen/standard_icon_size"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginLeft="@dimen/content_padding"
|
||||
android:layout_marginTop="@dimen/bottom_sheet_icon_margin"
|
||||
android:layout_marginRight="@dimen/bottom_sheet_icon_margin_large"
|
||||
android:layout_marginBottom="@dimen/bottom_sheet_icon_margin"
|
||||
osmand:srcCompat="@drawable/ic_action_user_account"
|
||||
android:tint="@color/active_buttons_and_links_text_disabled_light"
|
||||
android:layout_marginEnd="@dimen/content_padding"
|
||||
android:layout_marginStart="@dimen/content_padding" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="@dimen/content_padding"
|
||||
android:paddingRight="@dimen/content_padding"
|
||||
android:paddingStart="@dimen/content_padding"
|
||||
android:paddingEnd="@dimen/content_padding">
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/account_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="marquee"
|
||||
android:singleLine="true"
|
||||
android:letterSpacing="@dimen/text_button_letter_spacing"
|
||||
android:text="@string/login_account"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
osmand:typeface="@string/font_roboto_regular" />
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/user_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:letterSpacing="@dimen/description_letter_spacing"
|
||||
android:maxLines="4"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
osmand:typeface="@string/font_roboto_regular" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
|
@ -11,6 +11,7 @@
|
|||
Thx - Hardy
|
||||
|
||||
-->
|
||||
<string name="close_changset">Closed changset</string>
|
||||
<string name="user_login">Login</string>
|
||||
<string name="user_password">Password</string>
|
||||
<string name="login_account">Account</string>
|
||||
|
|
|
@ -15,6 +15,9 @@ import net.osmand.plus.activities.MapActivity;
|
|||
import net.osmand.plus.mapcontextmenu.MenuController;
|
||||
import net.osmand.plus.measurementtool.LoginBottomSheetFragment;
|
||||
import net.osmand.plus.osmedit.OsmPoint.Action;
|
||||
import net.osmand.plus.osmedit.dialogs.SendOsmNoteBottomSheetFragment;
|
||||
import net.osmand.plus.osmedit.dialogs.SendPoiBottomSheetFragment;
|
||||
import net.osmand.plus.osmedit.dialogs.SendPoiDialogFragment;
|
||||
import net.osmand.plus.osmedit.dialogs.SendPoiDialogFragment.SimpleProgressDialogPoiUploader;
|
||||
import net.osmand.plus.osmedit.oauth.OsmOAuthAuthorizationAdapter;
|
||||
import net.osmand.plus.render.RenderingIcons;
|
||||
|
@ -48,11 +51,18 @@ public class EditPOIMenuController extends MenuController {
|
|||
OsmandApplication app = activity.getMyApplication();
|
||||
OsmandSettings settings = app.getSettings();
|
||||
OsmOAuthAuthorizationAdapter client = new OsmOAuthAuthorizationAdapter(app);
|
||||
OsmPoint point = getOsmPoint();
|
||||
if (client.isValidToken()
|
||||
|| !Algorithms.isEmpty(settings.USER_NAME.get())
|
||||
&& !Algorithms.isEmpty(settings.USER_PASSWORD.get())) {
|
||||
SimpleProgressDialogPoiUploader poiDialogUploader = new SimpleProgressDialogPoiUploader(activity);
|
||||
poiDialogUploader.showProgressDialog(new OsmPoint[] {getOsmPoint()}, false, false);
|
||||
if (point instanceof OpenstreetmapPoint) {
|
||||
SendPoiBottomSheetFragment sendPoiBottomSheetFragment =
|
||||
SendPoiBottomSheetFragment.showInstance(new OsmPoint[]{getOsmPoint()}, SendPoiBottomSheetFragment.PoiUploaderType.SIMPLE);
|
||||
sendPoiBottomSheetFragment.show(activity.getSupportFragmentManager(), SendPoiDialogFragment.TAG);
|
||||
} else if ( point instanceof OsmNotesPoint) {
|
||||
SendOsmNoteBottomSheetFragment sendOsmNoteBottomSheetFragment =
|
||||
SendOsmNoteBottomSheetFragment.showInstance(new OsmPoint[]{getOsmPoint()}, SendOsmNoteBottomSheetFragment.PoiUploaderType.SIMPLE);
|
||||
sendOsmNoteBottomSheetFragment.show(activity.getSupportFragmentManager(), SendPoiDialogFragment.TAG);}
|
||||
} else {
|
||||
LoginBottomSheetFragment.showInstance(activity.getSupportFragmentManager(), null);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,121 @@
|
|||
package net.osmand.plus.osmedit.dialogs;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.widget.SwitchCompat;
|
||||
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
|
||||
import net.osmand.plus.base.bottomsheetmenu.SimpleBottomSheetItem;
|
||||
import net.osmand.plus.osmedit.OpenstreetmapPoint;
|
||||
import net.osmand.plus.osmedit.OsmPoint;
|
||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||
|
||||
public class SendOsmNoteBottomSheetFragment extends MenuBottomSheetDialogFragment {
|
||||
|
||||
public static final String TAG = "SendPoiBottomSheetFragment";
|
||||
public static final String OPENSTREETMAP_POINT = "openstreetmap_point";
|
||||
public static final String POI_UPLOADER_TYPE = "poi_uploader_type";
|
||||
private OsmPoint[] poi;
|
||||
|
||||
protected OsmandSettings settings;
|
||||
|
||||
public enum PoiUploaderType {
|
||||
SIMPLE,
|
||||
FRAGMENT
|
||||
}
|
||||
|
||||
protected OsmandApplication getMyApplication() {
|
||||
return (OsmandApplication) getActivity().getApplication();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createMenuItems(Bundle savedInstanceState) {
|
||||
String userName = getMyApplication().getSettings().USER_DISPLAY_NAME.get();
|
||||
final View sendOsmNoteView = View.inflate(getContext(), R.layout.send_osm_note_fragment, null);
|
||||
final LinearLayout accountBlockView = (LinearLayout) sendOsmNoteView.findViewById(R.id.account_block);
|
||||
final SwitchCompat uploadAnonymously = (SwitchCompat) sendOsmNoteView.findViewById(R.id.upload_anonymously_switch);
|
||||
final TextView accountName = (TextView) sendOsmNoteView.findViewById(R.id.user_name);
|
||||
accountName.setText(userName);
|
||||
accountBlockView.setVisibility(View.VISIBLE);
|
||||
uploadAnonymously.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
accountBlockView.setVisibility(isChecked ? View.GONE : View.VISIBLE);
|
||||
}
|
||||
});
|
||||
final SimpleBottomSheetItem titleItem = (SimpleBottomSheetItem) new SimpleBottomSheetItem.Builder()
|
||||
.setCustomView(sendOsmNoteView)
|
||||
.create();
|
||||
items.add(titleItem);
|
||||
}
|
||||
|
||||
public static SendOsmNoteBottomSheetFragment showInstance(@NonNull OsmPoint[] points, @NonNull PoiUploaderType uploaderType) {
|
||||
SendOsmNoteBottomSheetFragment fragment = new SendOsmNoteBottomSheetFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putSerializable(OPENSTREETMAP_POINT, points);
|
||||
bundle.putString(POI_UPLOADER_TYPE, uploaderType.name());
|
||||
fragment.setArguments(bundle);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected UiUtilities.DialogButtonType getRightBottomButtonType() {
|
||||
return (UiUtilities.DialogButtonType.PRIMARY);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRightBottomButtonClick() {
|
||||
View view = getView();
|
||||
poi = (OsmPoint[]) getArguments().getSerializable(OPENSTREETMAP_POINT);
|
||||
boolean hasPoiGroup = false;
|
||||
assert poi != null;
|
||||
for (OsmPoint p : poi) {
|
||||
if (p.getGroup() == OsmPoint.Group.POI) {
|
||||
hasPoiGroup = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
final boolean hasPOI = hasPoiGroup;
|
||||
final SwitchCompat uploadAnonymously = (SwitchCompat) view.findViewById(R.id.upload_anonymously_switch);
|
||||
final EditText messageEditText = (EditText) view.findViewById(R.id.message_field);
|
||||
final SendPoiDialogFragment.PoiUploaderType poiUploaderType = SendPoiDialogFragment.PoiUploaderType.valueOf(getArguments().getString(POI_UPLOADER_TYPE, SendPoiDialogFragment.PoiUploaderType.SIMPLE.name()));
|
||||
final SendPoiDialogFragment.ProgressDialogPoiUploader progressDialogPoiUploader;
|
||||
if (poiUploaderType == SendPoiDialogFragment.PoiUploaderType.SIMPLE && getActivity() instanceof MapActivity) {
|
||||
progressDialogPoiUploader =
|
||||
new SendPoiDialogFragment.SimpleProgressDialogPoiUploader((MapActivity) getActivity());
|
||||
} else {
|
||||
progressDialogPoiUploader = (SendPoiDialogFragment.ProgressDialogPoiUploader) getParentFragment();
|
||||
}
|
||||
if (progressDialogPoiUploader != null) {
|
||||
String comment = messageEditText.getText().toString();
|
||||
if (comment.length() > 0) {
|
||||
for (OsmPoint osmPoint : poi) {
|
||||
if (osmPoint.getGroup() == OsmPoint.Group.POI) {
|
||||
((OpenstreetmapPoint) osmPoint).setComment(comment);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
progressDialogPoiUploader.showProgressDialog(poi,
|
||||
false,
|
||||
!hasPOI && uploadAnonymously.isChecked());
|
||||
}
|
||||
dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getRightBottomButtonTextId() {
|
||||
return R.string.shared_string_upload;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,100 @@
|
|||
package net.osmand.plus.osmedit.dialogs;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.widget.SwitchCompat;
|
||||
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
|
||||
import net.osmand.plus.base.bottomsheetmenu.SimpleBottomSheetItem;
|
||||
import net.osmand.plus.osmedit.OpenstreetmapPoint;
|
||||
import net.osmand.plus.osmedit.OsmPoint;
|
||||
|
||||
public class SendPoiBottomSheetFragment extends MenuBottomSheetDialogFragment {
|
||||
|
||||
public static final String TAG = "SendPoiBottomSheetFragment";
|
||||
public static final String OPENSTREETMAP_POINT = "openstreetmap_point";
|
||||
public static final String POI_UPLOADER_TYPE = "poi_uploader_type";
|
||||
private OsmPoint[] poi;
|
||||
|
||||
public enum PoiUploaderType {
|
||||
SIMPLE,
|
||||
FRAGMENT
|
||||
}
|
||||
|
||||
protected OsmandApplication getMyApplication() {
|
||||
return (OsmandApplication) getActivity().getApplication();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createMenuItems(Bundle savedInstanceState) {
|
||||
String userName = getMyApplication().getSettings().USER_DISPLAY_NAME.get();
|
||||
final View sendOsmNoteView = View.inflate(getContext(), R.layout.send_poi_fragment, null);
|
||||
final TextView accountName = (TextView) sendOsmNoteView.findViewById(R.id.user_name);
|
||||
accountName.setText(userName);
|
||||
final SimpleBottomSheetItem titleItem = (SimpleBottomSheetItem) new SimpleBottomSheetItem.Builder()
|
||||
.setCustomView(sendOsmNoteView)
|
||||
.create();
|
||||
items.add(titleItem);
|
||||
}
|
||||
|
||||
public static SendPoiBottomSheetFragment showInstance(@NonNull OsmPoint[] points, @NonNull SendPoiBottomSheetFragment.PoiUploaderType uploaderType) {
|
||||
SendPoiBottomSheetFragment fragment = new SendPoiBottomSheetFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putSerializable(OPENSTREETMAP_POINT, points);
|
||||
bundle.putString(POI_UPLOADER_TYPE, uploaderType.name());
|
||||
fragment.setArguments(bundle);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected UiUtilities.DialogButtonType getRightBottomButtonType() {
|
||||
return (UiUtilities.DialogButtonType.PRIMARY);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRightBottomButtonClick() {
|
||||
View view = getView();
|
||||
poi = (OsmPoint[]) getArguments().getSerializable(OPENSTREETMAP_POINT);
|
||||
final SwitchCompat closeChangeSetCheckBox =
|
||||
(SwitchCompat) view.findViewById(R.id.close_change_set_checkbox);
|
||||
final EditText messageEditText = (EditText) view.findViewById(R.id.message_field);
|
||||
final SendPoiDialogFragment.PoiUploaderType poiUploaderType = SendPoiDialogFragment.PoiUploaderType.valueOf(getArguments().getString(POI_UPLOADER_TYPE, SendPoiDialogFragment.PoiUploaderType.SIMPLE.name()));
|
||||
final SendPoiDialogFragment.ProgressDialogPoiUploader progressDialogPoiUploader;
|
||||
if (poiUploaderType == SendPoiDialogFragment.PoiUploaderType.SIMPLE && getActivity() instanceof MapActivity) {
|
||||
progressDialogPoiUploader =
|
||||
new SendPoiDialogFragment.SimpleProgressDialogPoiUploader((MapActivity) getActivity());
|
||||
} else {
|
||||
progressDialogPoiUploader = (SendPoiDialogFragment.ProgressDialogPoiUploader) getParentFragment();
|
||||
}
|
||||
if (progressDialogPoiUploader != null) {
|
||||
String comment = messageEditText.getText().toString();
|
||||
if (comment.length() > 0) {
|
||||
for (OsmPoint osmPoint : poi) {
|
||||
if (osmPoint.getGroup() == OsmPoint.Group.POI) {
|
||||
((OpenstreetmapPoint) osmPoint).setComment(comment);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
progressDialogPoiUploader.showProgressDialog(poi,
|
||||
closeChangeSetCheckBox.isChecked(),
|
||||
false);
|
||||
}
|
||||
dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getRightBottomButtonTextId() {
|
||||
return R.string.shared_string_upload;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in a new issue