зеркало из https://github.com/mozilla/gecko-dev.git
Bug 790180 - AlertDialog must be created on the UI thread. r=sriram
This commit is contained in:
Родитель
8e73b6461f
Коммит
0343b2289f
|
@ -161,7 +161,8 @@ public class PromptService implements OnClickListener, OnCancelListener, OnItemC
|
|||
|
||||
// GeckoEventListener implementation
|
||||
public void handleMessage(String event, final JSONObject message) {
|
||||
GeckoAppShell.getHandler().post(new Runnable() {
|
||||
// The dialog must be created on the UI thread.
|
||||
GeckoAppShell.getMainHandler().post(new Runnable() {
|
||||
public void run() {
|
||||
processMessage(message);
|
||||
}
|
||||
|
@ -182,13 +183,11 @@ public class PromptService implements OnClickListener, OnCancelListener, OnItemC
|
|||
}
|
||||
|
||||
public void show(String aTitle, String aText, PromptButton[] aButtons, PromptListItem[] aMenuList, boolean aMultipleSelection) {
|
||||
GeckoApp.assertOnUiThread();
|
||||
|
||||
final LayerView layerView = GeckoApp.mAppContext.getLayerView();
|
||||
layerView.post(new Runnable() {
|
||||
public void run() {
|
||||
// treat actions that show a dialog as if preventDefault by content to prevent panning
|
||||
layerView.abortPanning();
|
||||
}
|
||||
});
|
||||
// treat actions that show a dialog as if preventDefault by content to prevent panning
|
||||
layerView.abortPanning();
|
||||
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(GeckoApp.mAppContext);
|
||||
if (!aTitle.equals("")) {
|
||||
|
@ -256,14 +255,9 @@ public class PromptService implements OnClickListener, OnCancelListener, OnItemC
|
|||
}
|
||||
}
|
||||
|
||||
// The AlertDialog must be created on the UI thread, not the GeckoBackgroundThread.
|
||||
GeckoAppShell.getMainHandler().post(new Runnable() {
|
||||
public void run() {
|
||||
mDialog = builder.create();
|
||||
mDialog.setOnCancelListener(PromptService.this);
|
||||
mDialog.show();
|
||||
}
|
||||
});
|
||||
mDialog = builder.create();
|
||||
mDialog.setOnCancelListener(PromptService.this);
|
||||
mDialog.show();
|
||||
}
|
||||
|
||||
public void onClick(DialogInterface aDialog, int aWhich) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче