Permalink
Browse files

[MOSYNC-2090] While a Dialog is visible, the Android device's back bu…

…tton is ignored.
  • Loading branch information...
1 parent 743677b commit 2957bc085dd57f6244c32639a5248b295bc7cafb Florin Leu committed Apr 10, 2012
@@ -18,8 +18,10 @@
package com.mosync.nativeui.ui.widgets;
import android.app.AlertDialog;
+import android.content.DialogInterface;
+import android.content.DialogInterface.OnDismissListener;
import android.view.ViewGroup;
-
+import com.mosync.internal.android.EventQueue;
import com.mosync.internal.generated.IX_WIDGET;
import com.mosync.nativeui.core.Types;
import com.mosync.nativeui.util.properties.InvalidPropertyValueException;
@@ -57,12 +59,22 @@
* @param handle handle Integer handle corresponding to this instance.
* @param view A screen wrapped by this widget.
*/
- public DialogWidget(int handle,AlertDialog.Builder builder, ViewGroup view)
+ public DialogWidget(int handle, AlertDialog.Builder builder, ViewGroup view)
{
super( handle, view );
m_dialogBuilder = builder;
m_dialog = m_dialogBuilder.create();
- m_dialog.setCancelable(false);
+ m_dialog.setOnDismissListener(new OnDismissListener() {
+ @Override
+ public void onDismiss(DialogInterface dialog) {
+ EventQueue.getDefault( ).postWidgetEvent(
+ IX_WIDGET.MAW_EVENT_DIALOG_DISMISSED,
+ getHandle(),
+ 0,
+ 0);
+ }
+ });
+
m_container = view;
}
@@ -209,4 +221,4 @@ public String getTitle()
return m_title;
}
-}
+}

0 comments on commit 2957bc0

Please sign in to comment.