Bug 725930: DoorHangerPopup should be initialized late to avoid problems in startup. [r=mfinkle]

This commit is contained in:
Sriram Ramasubramanian 2012-02-13 10:29:29 -08:00
Родитель b243fec4c9
Коммит de061510b9
1 изменённых файлов: 9 добавлений и 0 удалений

Просмотреть файл

@ -59,10 +59,15 @@ public class DoorHangerPopup extends PopupWindow {
private Context mContext;
private LinearLayout mContent;
private boolean mInflated;
public DoorHangerPopup(Context aContext) {
super(aContext);
mContext = aContext;
mInflated = false;
}
private void init() {
setBackgroundDrawable(new BitmapDrawable());
setOutsideTouchable(true);
setWindowLayoutMode(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
@ -72,12 +77,16 @@ public class DoorHangerPopup extends PopupWindow {
mContent = (LinearLayout) layout.findViewById(R.id.doorhanger_container);
setContentView(layout);
mInflated = true;
}
public void addDoorHanger(String message, String value, JSONArray buttons,
Tab tab, JSONObject options) {
Log.i(LOGTAG, "Adding a DoorHanger to Tab: " + tab.getId());
if (!mInflated)
init();
// Replace the doorhanger if it already exists
DoorHanger dh = tab.getDoorHanger(value);
if (dh != null) {