From 9e7928873bce1aa9b9de63f30d5d0019aa52a550 Mon Sep 17 00:00:00 2001 From: Jake McGinty Date: Wed, 24 Dec 2014 13:17:41 -0800 Subject: [PATCH] properly update transport options location // FREEBIE --- .../thoughtcrime/securesms/TransportOptions.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/org/thoughtcrime/securesms/TransportOptions.java b/src/org/thoughtcrime/securesms/TransportOptions.java index 268d7cc6c0..1056e63405 100644 --- a/src/org/thoughtcrime/securesms/TransportOptions.java +++ b/src/org/thoughtcrime/securesms/TransportOptions.java @@ -9,6 +9,7 @@ import android.text.style.RelativeSizeSpan; import android.util.Log; import android.view.LayoutInflater; import android.view.View; +import android.view.ViewTreeObserver.OnGlobalLayoutListener; import android.view.WindowManager; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; @@ -105,11 +106,19 @@ public class TransportOptions { setTransport(transport.key); } - public void showPopup(View parent) { + public void showPopup(final View parent) { initializeTransportPopup(); + final int xoff = context.getResources().getDimensionPixelOffset(R.dimen.transport_selection_popup_xoff); + final int yoff = context.getResources().getDimensionPixelOffset(R.dimen.transport_selection_popup_yoff); transportPopup.showAsDropDown(parent, - context.getResources().getDimensionPixelOffset(R.dimen.transport_selection_popup_xoff), - context.getResources().getDimensionPixelOffset(R.dimen.transport_selection_popup_yoff)); + xoff, + yoff); + parent.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() { + @Override + public void onGlobalLayout() { + transportPopup.update(parent, xoff, yoff, -1, -1); + } + }); } public void setDefaultTransport(String transportName) {