forked from organicmaps/organicmaps
[android] Properly display snackbars above their long-tapped controls
Signed-off-by: Alexander Borsuk <me@alex.bio>
This commit is contained in:
parent
727b73a3e1
commit
dbb27a9531
6 changed files with 8 additions and 10 deletions
|
@ -1686,7 +1686,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
|
|||
@Override
|
||||
public void onBookmarksFileLoaded(boolean success)
|
||||
{
|
||||
Utils.showSnackbar(this, findViewById(R.id.coordinator), null,
|
||||
Utils.showSnackbar(this, findViewById(R.id.coordinator),
|
||||
success ? R.string.load_kmz_successful : R.string.load_kmz_failed);
|
||||
}
|
||||
|
||||
|
|
|
@ -79,12 +79,11 @@ public class PlacePageUtils
|
|||
public static void copyToClipboard(Context context, View frame, String text)
|
||||
{
|
||||
Utils.copyTextToClipboard(context, text);
|
||||
Utils.showSnackbarAbove(frame,
|
||||
frame.getRootView().findViewById(R.id.pp_buttons_layout),
|
||||
Utils.showSnackbarAbove(frame.getRootView().findViewById(R.id.pp_buttons_layout), frame,
|
||||
context.getString(R.string.copied_to_clipboard, text));
|
||||
}
|
||||
|
||||
public static void showCopyPopup(Context context, View popupAnchor, View frame, List<String> items)
|
||||
public static void showCopyPopup(Context context, View popupAnchor, List<String> items)
|
||||
{
|
||||
final PopupMenu popup = new PopupMenu(context, popupAnchor);
|
||||
final Menu menu = popup.getMenu();
|
||||
|
@ -95,7 +94,7 @@ public class PlacePageUtils
|
|||
|
||||
popup.setOnMenuItemClickListener(item -> {
|
||||
final String text = items.get(item.getItemId());
|
||||
copyToClipboard(context, frame, text);
|
||||
copyToClipboard(context, popupAnchor, text);
|
||||
return true;
|
||||
});
|
||||
popup.show();
|
||||
|
|
|
@ -543,7 +543,7 @@ public class PlacePageView extends Fragment implements View.OnClickListener,
|
|||
if (items.size() == 1)
|
||||
PlacePageUtils.copyToClipboard(context, mFrame, items.get(0));
|
||||
else
|
||||
PlacePageUtils.showCopyPopup(context, v, mFrame, items);
|
||||
PlacePageUtils.showCopyPopup(context, v, items);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -136,8 +136,7 @@ public class PlacePageBookmarkFragment extends Fragment implements View.OnClickL
|
|||
|
||||
final Context ctx = requireContext();
|
||||
Utils.copyTextToClipboard(ctx, notes);
|
||||
Utils.showSnackbarAbove(mFrame,
|
||||
mFrame.getRootView().findViewById(R.id.pp_buttons_layout),
|
||||
Utils.showSnackbarAbove(mFrame.getRootView().findViewById(R.id.pp_buttons_layout), mFrame,
|
||||
ctx.getString(R.string.copied_to_clipboard, notes));
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -185,7 +185,7 @@ public class PlacePageLinksFragment extends Fragment implements Observer<MapObje
|
|||
if (items.size() == 1)
|
||||
PlacePageUtils.copyToClipboard(requireContext(), mFrame, items.get(0));
|
||||
else
|
||||
PlacePageUtils.showCopyPopup(requireContext(), view, mFrame, items);
|
||||
PlacePageUtils.showCopyPopup(requireContext(), view, items);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ public class PlacePhoneAdapter extends RecyclerView.Adapter<PlacePhoneAdapter.Vi
|
|||
final String phoneNumber = mPhone.getText().toString();
|
||||
final Context ctx = view.getContext();
|
||||
Utils.copyTextToClipboard(ctx, phoneNumber);
|
||||
Utils.showSnackbarAbove(view, view.getRootView().findViewById(R.id.pp_buttons_layout),
|
||||
Utils.showSnackbarAbove(view.getRootView().findViewById(R.id.pp_buttons_layout), view,
|
||||
ctx.getString(R.string.copied_to_clipboard, phoneNumber));
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue