[android] Added click processing for html error dialog + some cosmetic fixes such like nonnull fragment's calls, change icon, etc.
BIN
android/res/drawable-hdpi/ic_error_red.png
Normal file
After Width: | Height: | Size: 696 B |
BIN
android/res/drawable-hdpi/img_editonweb.png
Normal file
After Width: | Height: | Size: 36 KiB |
Before Width: | Height: | Size: 35 KiB |
BIN
android/res/drawable-mdpi/ic_error_red.png
Normal file
After Width: | Height: | Size: 514 B |
BIN
android/res/drawable-mdpi/img_editonweb.png
Normal file
After Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 23 KiB |
BIN
android/res/drawable-xhdpi/ic_error_red.png
Normal file
After Width: | Height: | Size: 781 B |
BIN
android/res/drawable-xhdpi/img_editonweb.png
Normal file
After Width: | Height: | Size: 48 KiB |
Before Width: | Height: | Size: 47 KiB |
BIN
android/res/drawable-xxhdpi/ic_error_red.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
android/res/drawable-xxhdpi/img_editonweb.png
Normal file
After Width: | Height: | Size: 75 KiB |
Before Width: | Height: | Size: 73 KiB |
BIN
android/res/drawable-xxxhdpi/ic_error_red.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
android/res/drawable-xxxhdpi/img_editonweb.png
Normal file
After Width: | Height: | Size: 105 KiB |
Before Width: | Height: | Size: 100 KiB |
|
@ -21,7 +21,9 @@
|
|||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="0dp"
|
||||
tools:ignore="UnusedAttribute"/>
|
||||
tools:ignore="UnusedAttribute"
|
||||
android:layout_marginRight="@dimen/margin_base"
|
||||
android:layout_marginEnd="@dimen/margin_base"/>
|
||||
<ImageView
|
||||
android:id="@+id/image"
|
||||
android:layout_gravity="center_vertical"
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
android:layout_height="match_parent"
|
||||
android:gravity="center_horizontal"
|
||||
android:layout_weight="1"
|
||||
mapsme:imgSrcDefault="@drawable/img_guide_edit_on_web"
|
||||
mapsme:imgSrcDefault="@drawable/img_editonweb"
|
||||
mapsme:titleDefault="@string/edit_guide_title"
|
||||
mapsme:subTitleDefault="@string/edit_guide_subtitle"/>
|
||||
<Button
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.mapswithme.maps.ugc.routes;
|
|||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.support.v4.app.ShareCompat;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
@ -15,13 +16,15 @@ import com.mapswithme.maps.bookmarks.data.BookmarkManager;
|
|||
import com.mapswithme.maps.bookmarks.data.CatalogCustomProperty;
|
||||
import com.mapswithme.maps.bookmarks.data.CatalogTagsGroup;
|
||||
import com.mapswithme.maps.dialog.AlertDialog;
|
||||
import com.mapswithme.maps.dialog.AlertDialogCallback;
|
||||
import com.mapswithme.util.sharing.TargetUtils;
|
||||
import com.mapswithme.util.statistics.Statistics;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class SendLinkPlaceholderFragment extends BaseAuthFragment implements BookmarkManager.BookmarksCatalogListener
|
||||
public class SendLinkPlaceholderFragment extends BaseAuthFragment implements BookmarkManager.BookmarksCatalogListener,
|
||||
AlertDialogCallback
|
||||
{
|
||||
public static final String EXTRA_CATEGORY = "bookmarks_category";
|
||||
private static final String BODY_STRINGS_SEPARATOR = "\n\n";
|
||||
|
@ -77,18 +80,23 @@ public class SendLinkPlaceholderFragment extends BaseAuthFragment implements Boo
|
|||
|
||||
private void shareLink()
|
||||
{
|
||||
String emailBody = getString(R.string.edit_your_guide_email_body) + BODY_STRINGS_SEPARATOR +
|
||||
BookmarkManager.INSTANCE.getWebEditorUrl(mCategory.getServerId());
|
||||
|
||||
ShareCompat.IntentBuilder.from(getActivity())
|
||||
.setType(TargetUtils.TYPE_TEXT_PLAIN)
|
||||
.setSubject(getString(R.string.edit_guide_title))
|
||||
.setText(emailBody)
|
||||
.setChooserTitle(getString(R.string.share))
|
||||
.startChooser();
|
||||
shareLink(BookmarkManager.INSTANCE.getWebEditorUrl(mCategory.getServerId()), requireActivity());
|
||||
Statistics.INSTANCE.trackEvent(Statistics.EventName.BM_EDIT_ON_WEB_CLICK);
|
||||
}
|
||||
|
||||
static void shareLink(@NonNull String url, @NonNull FragmentActivity activity)
|
||||
{
|
||||
String emailBody = activity.getString(R.string.edit_your_guide_email_body)
|
||||
+ BODY_STRINGS_SEPARATOR + url;
|
||||
|
||||
ShareCompat.IntentBuilder.from(activity)
|
||||
.setType(TargetUtils.TYPE_TEXT_PLAIN)
|
||||
.setSubject(activity.getString(R.string.edit_guide_title))
|
||||
.setText(emailBody)
|
||||
.setChooserTitle(activity.getString(R.string.share))
|
||||
.startChooser();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUploadFinished(@NonNull BookmarkManager.UploadResult uploadResult, @NonNull
|
||||
String description, long originCategoryId, long resultCategoryId)
|
||||
|
@ -105,11 +113,11 @@ public class SendLinkPlaceholderFragment extends BaseAuthFragment implements Boo
|
|||
|
||||
private void onUploadFailed()
|
||||
{
|
||||
/* FIXME text*/
|
||||
AlertDialog dialog = new AlertDialog.Builder()
|
||||
.setTitleId(R.string.unable_upload_error_subtitle_edited)
|
||||
.setMessageId(R.string.unable_upload_error_subtitle_edited)
|
||||
.setPositiveBtnId(R.string.ok)
|
||||
.setTitleId(R.string.html_error_upload_title_try_again)
|
||||
.setMessageId(R.string.html_error_upload_message_try_again)
|
||||
.setPositiveBtnId(R.string.try_again)
|
||||
.setNegativeBtnId(R.string.cancel)
|
||||
.setReqCode(REQ_CODE_ERROR_EDITED_ON_WEB_DIALOG)
|
||||
.setFragManagerStrategyType(AlertDialog.FragManagerStrategyType.ACTIVITY_FRAGMENT_MANAGER)
|
||||
.build();
|
||||
|
@ -192,4 +200,22 @@ public class SendLinkPlaceholderFragment extends BaseAuthFragment implements Boo
|
|||
{
|
||||
/* do noting by default */
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAlertDialogPositiveClick(int requestCode, int which)
|
||||
{
|
||||
shareLink();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAlertDialogNegativeClick(int requestCode, int which)
|
||||
{
|
||||
/* do noting by default */
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAlertDialogCancel(int requestCode)
|
||||
{
|
||||
/* do noting by default */
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ public class UgcSharingOptionsFragment extends BaseToolbarAuthFragment implement
|
|||
private static final String UPLOAD_CONFIRMATION_DIALOG_TAG = "upload_confirmation_dialog";
|
||||
private static final String UPDATE_CONFIRMATION_DIALOG_TAG = "update_confirmation_dialog";
|
||||
private static final String ERROR_HTML_FORMATTING_DIALOG_TAG = "error_html_formatting_dialog";
|
||||
private static final int MIN_REQUIRED_CATEGORY_SIZE = 3;
|
||||
private static final int MIN_REQUIRED_CATEGORY_SIZE = 0;
|
||||
|
||||
@SuppressWarnings("NullableProblems")
|
||||
@NonNull
|
||||
|
@ -131,7 +131,7 @@ public class UgcSharingOptionsFragment extends BaseToolbarAuthFragment implement
|
|||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState)
|
||||
{
|
||||
View root = inflater.inflate(R.layout.fragment_ugc_routes_sharing_options, container, false);
|
||||
|
@ -205,7 +205,7 @@ public class UgcSharingOptionsFragment extends BaseToolbarAuthFragment implement
|
|||
@Override
|
||||
protected ToolbarController onCreateToolbarController(@NonNull View root)
|
||||
{
|
||||
return new FinishActivityToolbarController(root, getActivity());
|
||||
return new FinishActivityToolbarController(root, requireActivity());
|
||||
}
|
||||
|
||||
private void initClickListeners(@NonNull View root)
|
||||
|
@ -282,7 +282,7 @@ public class UgcSharingOptionsFragment extends BaseToolbarAuthFragment implement
|
|||
|
||||
private void showNoNetworkConnectionDialog()
|
||||
{
|
||||
Fragment fragment = getFragmentManager().findFragmentByTag(NO_NETWORK_CONNECTION_DIALOG_TAG);
|
||||
Fragment fragment = requireFragmentManager().findFragmentByTag(NO_NETWORK_CONNECTION_DIALOG_TAG);
|
||||
if (fragment != null)
|
||||
return;
|
||||
|
||||
|
@ -378,7 +378,7 @@ public class UgcSharingOptionsFragment extends BaseToolbarAuthFragment implement
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(Bundle outState)
|
||||
public void onSaveInstanceState(@NonNull Bundle outState)
|
||||
{
|
||||
super.onSaveInstanceState(outState);
|
||||
if (mCurrentMode != null)
|
||||
|
@ -498,7 +498,7 @@ public class UgcSharingOptionsFragment extends BaseToolbarAuthFragment implement
|
|||
private void onUploadError(@NonNull BookmarkManager.UploadResult uploadResult)
|
||||
{
|
||||
Statistics.INSTANCE.trackSharingOptionsError(Statistics.EventName.BM_SHARING_OPTIONS_UPLOAD_ERROR,
|
||||
uploadResult.ordinal());
|
||||
uploadResult.ordinal());
|
||||
if (uploadResult == BookmarkManager.UploadResult.UPLOAD_RESULT_MALFORMED_DATA_ERROR)
|
||||
{
|
||||
showHtmlFormattingError();
|
||||
|
@ -581,10 +581,13 @@ public class UgcSharingOptionsFragment extends BaseToolbarAuthFragment implement
|
|||
public void onAlertDialogPositiveClick(int requestCode, int which)
|
||||
{
|
||||
if (requestCode == REQ_CODE_NO_NETWORK_CONNECTION_DIALOG)
|
||||
Utils.showSystemSettings(getContext());
|
||||
Utils.showSystemSettings(requireContext());
|
||||
else if (requestCode == REQ_CODE_UPLOAD_CONFIRMATION_DIALOG
|
||||
|| requestCode == REQ_CODE_UPDATE_CONFIRMATION_DIALOG)
|
||||
requestUpload();
|
||||
else if (requestCode == REQ_CODE_ERROR_HTML_FORMATTING_DIALOG)
|
||||
SendLinkPlaceholderFragment.shareLink(BookmarkManager.INSTANCE.getWebEditorUrl(mCategory.getServerId()),
|
||||
requireActivity());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -620,13 +623,19 @@ public class UgcSharingOptionsFragment extends BaseToolbarAuthFragment implement
|
|||
|
||||
private void showHtmlFormattingError()
|
||||
{
|
||||
showConfirmationDialog(R.string.html_format_error_title,
|
||||
R.string.html_format_error_subtitle,
|
||||
R.string.edit_on_web,
|
||||
R.string.cancel,
|
||||
ERROR_HTML_FORMATTING_DIALOG_TAG,
|
||||
REQ_CODE_ERROR_HTML_FORMATTING_DIALOG
|
||||
);
|
||||
AlertDialog dialog = new AlertDialog.Builder()
|
||||
.setTitleId(R.string.html_format_error_title)
|
||||
.setMessageId(R.string.html_format_error_subtitle)
|
||||
.setPositiveBtnId(R.string.edit_on_web)
|
||||
.setNegativeBtnId(R.string.cancel)
|
||||
.setReqCode(REQ_CODE_ERROR_HTML_FORMATTING_DIALOG)
|
||||
.setImageResId(R.drawable.ic_error_red)
|
||||
.setFragManagerStrategyType(AlertDialog.FragManagerStrategyType.ACTIVITY_FRAGMENT_MANAGER)
|
||||
.setDialogViewStrategyType(AlertDialog.DialogViewStrategyType.CONFIRMATION_DIALOG)
|
||||
.setDialogFactory(new ConfirmationDialogFactory())
|
||||
.build();
|
||||
dialog.setTargetFragment(this, REQ_CODE_ERROR_HTML_FORMATTING_DIALOG);
|
||||
dialog.show(this, ERROR_HTML_FORMATTING_DIALOG_TAG);
|
||||
}
|
||||
|
||||
private void showUploadCatalogConfirmationDialog()
|
||||
|
|