gecko/mobile/android/base/PromptService.java

462 lines
17 KiB
Java
Raw Normal View History

Bug 0 - Moving embedding/android into mobile/android/base. r=mfinkle,blassey --HG-- rename : embedding/android/AlertNotification.java => mobile/android/base/AlertNotification.java rename : embedding/android/AndroidManifest.xml.in => mobile/android/base/AndroidManifest.xml.in rename : embedding/android/App.java.in => mobile/android/base/App.java.in rename : embedding/android/AwesomeBar.java => mobile/android/base/AwesomeBar.java rename : embedding/android/AwesomeBarTabs.java => mobile/android/base/AwesomeBarTabs.java rename : embedding/android/BrowserToolbar.java => mobile/android/base/BrowserToolbar.java rename : embedding/android/ConfirmPreference.java => mobile/android/base/ConfirmPreference.java rename : embedding/android/CrashReporter.java.in => mobile/android/base/CrashReporter.java.in rename : embedding/android/DoorHanger.java => mobile/android/base/DoorHanger.java rename : embedding/android/DoorHangerPopup.java => mobile/android/base/DoorHangerPopup.java rename : embedding/android/Favicons.java => mobile/android/base/Favicons.java rename : embedding/android/GeckoApp.java => mobile/android/base/GeckoApp.java rename : embedding/android/GeckoAppShell.java => mobile/android/base/GeckoAppShell.java rename : embedding/android/GeckoAsyncTask.java => mobile/android/base/GeckoAsyncTask.java rename : embedding/android/GeckoBatteryManager.java => mobile/android/base/GeckoBatteryManager.java rename : embedding/android/GeckoConnectivityReceiver.java => mobile/android/base/GeckoConnectivityReceiver.java rename : embedding/android/GeckoEvent.java => mobile/android/base/GeckoEvent.java rename : embedding/android/GeckoEventListener.java => mobile/android/base/GeckoEventListener.java rename : embedding/android/GeckoInputConnection.java => mobile/android/base/GeckoInputConnection.java rename : embedding/android/GeckoPreferences.java => mobile/android/base/GeckoPreferences.java rename : embedding/android/GeckoStateListDrawable.java => mobile/android/base/GeckoStateListDrawable.java rename : embedding/android/GeckoThread.java => mobile/android/base/GeckoThread.java rename : embedding/android/GlobalHistory.java => mobile/android/base/GlobalHistory.java rename : embedding/android/LauncherShortcuts.java.in => mobile/android/base/LauncherShortcuts.java.in rename : embedding/android/Makefile.in => mobile/android/base/Makefile.in rename : embedding/android/NotificationHandler.java.in => mobile/android/base/NotificationHandler.java.in rename : embedding/android/PromptService.java => mobile/android/base/PromptService.java rename : embedding/android/Restarter.java.in => mobile/android/base/Restarter.java.in rename : embedding/android/SurfaceLockInfo.java => mobile/android/base/SurfaceLockInfo.java rename : embedding/android/Tab.java => mobile/android/base/Tab.java rename : embedding/android/Tabs.java => mobile/android/base/Tabs.java rename : embedding/android/TabsTray.java => mobile/android/base/TabsTray.java rename : embedding/android/gfx/BufferedCairoImage.java => mobile/android/base/gfx/BufferedCairoImage.java rename : embedding/android/gfx/CairoImage.java => mobile/android/base/gfx/CairoImage.java rename : embedding/android/gfx/CairoUtils.java => mobile/android/base/gfx/CairoUtils.java rename : embedding/android/gfx/GeckoSoftwareLayerClient.java => mobile/android/base/gfx/GeckoSoftwareLayerClient.java rename : embedding/android/gfx/InputConnectionHandler.java => mobile/android/base/gfx/InputConnectionHandler.java rename : embedding/android/gfx/IntSize.java => mobile/android/base/gfx/IntSize.java rename : embedding/android/gfx/Layer.java => mobile/android/base/gfx/Layer.java rename : embedding/android/gfx/LayerClient.java => mobile/android/base/gfx/LayerClient.java rename : embedding/android/gfx/LayerController.java => mobile/android/base/gfx/LayerController.java rename : embedding/android/gfx/LayerRenderer.java => mobile/android/base/gfx/LayerRenderer.java rename : embedding/android/gfx/LayerView.java => mobile/android/base/gfx/LayerView.java rename : embedding/android/gfx/NinePatchTileLayer.java => mobile/android/base/gfx/NinePatchTileLayer.java rename : embedding/android/gfx/PlaceholderLayerClient.java => mobile/android/base/gfx/PlaceholderLayerClient.java rename : embedding/android/gfx/PointUtils.java => mobile/android/base/gfx/PointUtils.java rename : embedding/android/gfx/RectUtils.java => mobile/android/base/gfx/RectUtils.java rename : embedding/android/gfx/SingleTileLayer.java => mobile/android/base/gfx/SingleTileLayer.java rename : embedding/android/gfx/TextLayer.java => mobile/android/base/gfx/TextLayer.java rename : embedding/android/gfx/TextureReaper.java => mobile/android/base/gfx/TextureReaper.java rename : embedding/android/gfx/TileLayer.java => mobile/android/base/gfx/TileLayer.java rename : embedding/android/locales/Makefile.in => mobile/android/base/locales/Makefile.in rename : embedding/android/locales/en-US/android_strings.dtd => mobile/android/base/locales/en-US/android_strings.dtd rename : embedding/android/locales/jar.mn => mobile/android/base/locales/jar.mn rename : embedding/android/locales/l10n.ini => mobile/android/base/locales/l10n.ini rename : embedding/android/package-name.txt.in => mobile/android/base/package-name.txt.in rename : embedding/android/resources/anim/grow_fade_in.xml => mobile/android/base/resources/anim/grow_fade_in.xml rename : embedding/android/resources/anim/shrink_fade_out.xml => mobile/android/base/resources/anim/shrink_fade_out.xml rename : embedding/android/resources/color/awesomebar_tab_text.xml => mobile/android/base/resources/color/awesomebar_tab_text.xml rename : embedding/android/resources/drawable-hdpi-v11/address_bar_url_bg.9.png => mobile/android/base/resources/drawable-hdpi-v11/address_bar_url_bg.9.png rename : embedding/android/resources/drawable-hdpi-v11/ic_menu_bookmark_add.png => mobile/android/base/resources/drawable-hdpi-v11/ic_menu_bookmark_add.png rename : embedding/android/resources/drawable-hdpi-v11/ic_menu_bookmark_remove.png => mobile/android/base/resources/drawable-hdpi-v11/ic_menu_bookmark_remove.png rename : embedding/android/resources/drawable-hdpi-v11/ic_menu_find_in_page.png => mobile/android/base/resources/drawable-hdpi-v11/ic_menu_find_in_page.png rename : embedding/android/resources/drawable-hdpi-v11/ic_menu_forward.png => mobile/android/base/resources/drawable-hdpi-v11/ic_menu_forward.png rename : embedding/android/resources/drawable-hdpi-v11/ic_menu_reload.png => mobile/android/base/resources/drawable-hdpi-v11/ic_menu_reload.png rename : embedding/android/resources/drawable-hdpi-v11/ic_menu_save_as_pdf.png => mobile/android/base/resources/drawable-hdpi-v11/ic_menu_save_as_pdf.png rename : embedding/android/resources/drawable-hdpi-v11/ic_menu_share.png => mobile/android/base/resources/drawable-hdpi-v11/ic_menu_share.png rename : embedding/android/resources/drawable-hdpi-v11/tabs_more.png => mobile/android/base/resources/drawable-hdpi-v11/tabs_more.png rename : embedding/android/resources/drawable-hdpi-v11/tabs_normal.png => mobile/android/base/resources/drawable-hdpi-v11/tabs_normal.png rename : embedding/android/resources/drawable-hdpi-v11/tabs_plus.png => mobile/android/base/resources/drawable-hdpi-v11/tabs_plus.png rename : embedding/android/resources/drawable-hdpi-v11/tabs_pressed.png => mobile/android/base/resources/drawable-hdpi-v11/tabs_pressed.png rename : embedding/android/resources/drawable-hdpi-v8/address_bar_url_bg.9.png => mobile/android/base/resources/drawable-hdpi-v8/address_bar_url_bg.9.png rename : embedding/android/resources/drawable-hdpi-v8/doorhanger_arrow.png => mobile/android/base/resources/drawable-hdpi-v8/doorhanger_arrow.png rename : embedding/android/resources/drawable-hdpi-v8/doorhanger_bg.9.png => mobile/android/base/resources/drawable-hdpi-v8/doorhanger_bg.9.png rename : embedding/android/resources/drawable-hdpi-v8/doorhanger_popup_bg.9.png => mobile/android/base/resources/drawable-hdpi-v8/doorhanger_popup_bg.9.png rename : embedding/android/resources/drawable-hdpi-v8/doorhanger_shadow_bg.9.png => mobile/android/base/resources/drawable-hdpi-v8/doorhanger_shadow_bg.9.png rename : embedding/android/resources/drawable-hdpi-v8/ic_menu_bookmark_add.png => mobile/android/base/resources/drawable-hdpi-v8/ic_menu_bookmark_add.png rename : embedding/android/resources/drawable-hdpi-v8/ic_menu_bookmark_remove.png => mobile/android/base/resources/drawable-hdpi-v8/ic_menu_bookmark_remove.png rename : embedding/android/resources/drawable-hdpi-v8/ic_menu_find_in_page.png => mobile/android/base/resources/drawable-hdpi-v8/ic_menu_find_in_page.png rename : embedding/android/resources/drawable-hdpi-v8/ic_menu_forward.png => mobile/android/base/resources/drawable-hdpi-v8/ic_menu_forward.png rename : embedding/android/resources/drawable-hdpi-v8/ic_menu_reload.png => mobile/android/base/resources/drawable-hdpi-v8/ic_menu_reload.png rename : embedding/android/resources/drawable-hdpi-v8/ic_menu_save_as_pdf.png => mobile/android/base/resources/drawable-hdpi-v8/ic_menu_save_as_pdf.png rename : embedding/android/resources/drawable-hdpi-v8/ic_menu_share.png => mobile/android/base/resources/drawable-hdpi-v8/ic_menu_share.png rename : embedding/android/resources/drawable-hdpi-v8/site_security_lock.png => mobile/android/base/resources/drawable-hdpi-v8/site_security_lock.png rename : embedding/android/resources/drawable-hdpi-v8/tabs_more.png => mobile/android/base/resources/drawable-hdpi-v8/tabs_more.png rename : embedding/android/resources/drawable-hdpi-v8/tabs_normal.png => mobile/android/base/resources/drawable-hdpi-v8/tabs_normal.png rename : embedding/android/resources/drawable-hdpi-v8/tabs_plus.png => mobile/android/base/resources/drawable-hdpi-v8/tabs_plus.png rename : embedding/android/resources/drawable-hdpi-v8/tabs_pressed.png => mobile/android/base/resources/drawable-hdpi-v8/tabs_pressed.png rename : embedding/android/resources/drawable-hdpi-v8/urlbar_stop.png => mobile/android/base/resources/drawable-hdpi-v8/urlbar_stop.png rename : embedding/android/resources/drawable-hdpi-v9/ic_menu_bookmark_add.png => mobile/android/base/resources/drawable-hdpi-v9/ic_menu_bookmark_add.png rename : embedding/android/resources/drawable-hdpi-v9/ic_menu_bookmark_remove.png => mobile/android/base/resources/drawable-hdpi-v9/ic_menu_bookmark_remove.png rename : embedding/android/resources/drawable-hdpi-v9/ic_menu_find_in_page.png => mobile/android/base/resources/drawable-hdpi-v9/ic_menu_find_in_page.png rename : embedding/android/resources/drawable-hdpi-v9/ic_menu_forward.png => mobile/android/base/resources/drawable-hdpi-v9/ic_menu_forward.png rename : embedding/android/resources/drawable-hdpi-v9/ic_menu_reload.png => mobile/android/base/resources/drawable-hdpi-v9/ic_menu_reload.png rename : embedding/android/resources/drawable-hdpi-v9/ic_menu_save_as_pdf.png => mobile/android/base/resources/drawable-hdpi-v9/ic_menu_save_as_pdf.png rename : embedding/android/resources/drawable-hdpi-v9/ic_menu_share.png => mobile/android/base/resources/drawable-hdpi-v9/ic_menu_share.png rename : embedding/android/resources/drawable-mdpi-v11/address_bar_url_bg.9.png => mobile/android/base/resources/drawable-mdpi-v11/address_bar_url_bg.9.png rename : embedding/android/resources/drawable-mdpi-v11/ic_menu_bookmark_add.png => mobile/android/base/resources/drawable-mdpi-v11/ic_menu_bookmark_add.png rename : embedding/android/resources/drawable-mdpi-v11/ic_menu_bookmark_remove.png => mobile/android/base/resources/drawable-mdpi-v11/ic_menu_bookmark_remove.png rename : embedding/android/resources/drawable-mdpi-v11/ic_menu_find_in_page.png => mobile/android/base/resources/drawable-mdpi-v11/ic_menu_find_in_page.png rename : embedding/android/resources/drawable-mdpi-v11/ic_menu_forward.png => mobile/android/base/resources/drawable-mdpi-v11/ic_menu_forward.png rename : embedding/android/resources/drawable-mdpi-v11/ic_menu_reload.png => mobile/android/base/resources/drawable-mdpi-v11/ic_menu_reload.png rename : embedding/android/resources/drawable-mdpi-v11/ic_menu_save_as_pdf.png => mobile/android/base/resources/drawable-mdpi-v11/ic_menu_save_as_pdf.png rename : embedding/android/resources/drawable-mdpi-v11/ic_menu_share.png => mobile/android/base/resources/drawable-mdpi-v11/ic_menu_share.png rename : embedding/android/resources/drawable-mdpi-v11/tabs_more.png => mobile/android/base/resources/drawable-mdpi-v11/tabs_more.png rename : embedding/android/resources/drawable-mdpi-v11/tabs_normal.png => mobile/android/base/resources/drawable-mdpi-v11/tabs_normal.png rename : embedding/android/resources/drawable-mdpi-v11/tabs_plus.png => mobile/android/base/resources/drawable-mdpi-v11/tabs_plus.png rename : embedding/android/resources/drawable-mdpi-v11/tabs_pressed.png => mobile/android/base/resources/drawable-mdpi-v11/tabs_pressed.png rename : embedding/android/resources/drawable-mdpi-v8/address_bar_url_bg.9.png => mobile/android/base/resources/drawable-mdpi-v8/address_bar_url_bg.9.png rename : embedding/android/resources/drawable-mdpi-v8/doorhanger_arrow.png => mobile/android/base/resources/drawable-mdpi-v8/doorhanger_arrow.png rename : embedding/android/resources/drawable-mdpi-v8/doorhanger_bg.9.png => mobile/android/base/resources/drawable-mdpi-v8/doorhanger_bg.9.png rename : embedding/android/resources/drawable-mdpi-v8/doorhanger_popup_bg.9.png => mobile/android/base/resources/drawable-mdpi-v8/doorhanger_popup_bg.9.png rename : embedding/android/resources/drawable-mdpi-v8/doorhanger_shadow_bg.9.png => mobile/android/base/resources/drawable-mdpi-v8/doorhanger_shadow_bg.9.png rename : embedding/android/resources/drawable-mdpi-v8/ic_menu_bookmark_add.png => mobile/android/base/resources/drawable-mdpi-v8/ic_menu_bookmark_add.png rename : embedding/android/resources/drawable-mdpi-v8/ic_menu_bookmark_remove.png => mobile/android/base/resources/drawable-mdpi-v8/ic_menu_bookmark_remove.png rename : embedding/android/resources/drawable-mdpi-v8/ic_menu_find_in_page.png => mobile/android/base/resources/drawable-mdpi-v8/ic_menu_find_in_page.png rename : embedding/android/resources/drawable-mdpi-v8/ic_menu_forward.png => mobile/android/base/resources/drawable-mdpi-v8/ic_menu_forward.png rename : embedding/android/resources/drawable-mdpi-v8/ic_menu_reload.png => mobile/android/base/resources/drawable-mdpi-v8/ic_menu_reload.png rename : embedding/android/resources/drawable-mdpi-v8/ic_menu_save_as_pdf.png => mobile/android/base/resources/drawable-mdpi-v8/ic_menu_save_as_pdf.png rename : embedding/android/resources/drawable-mdpi-v8/ic_menu_share.png => mobile/android/base/resources/drawable-mdpi-v8/ic_menu_share.png rename : embedding/android/resources/drawable-mdpi-v8/site_security_lock.png => mobile/android/base/resources/drawable-mdpi-v8/site_security_lock.png rename : embedding/android/resources/drawable-mdpi-v8/tabs_more.png => mobile/android/base/resources/drawable-mdpi-v8/tabs_more.png rename : embedding/android/resources/drawable-mdpi-v8/tabs_normal.png => mobile/android/base/resources/drawable-mdpi-v8/tabs_normal.png rename : embedding/android/resources/drawable-mdpi-v8/tabs_plus.png => mobile/android/base/resources/drawable-mdpi-v8/tabs_plus.png rename : embedding/android/resources/drawable-mdpi-v8/tabs_pressed.png => mobile/android/base/resources/drawable-mdpi-v8/tabs_pressed.png rename : embedding/android/resources/drawable-mdpi-v8/urlbar_stop.png => mobile/android/base/resources/drawable-mdpi-v8/urlbar_stop.png rename : embedding/android/resources/drawable-mdpi-v9/ic_menu_bookmark_add.png => mobile/android/base/resources/drawable-mdpi-v9/ic_menu_bookmark_add.png rename : embedding/android/resources/drawable-mdpi-v9/ic_menu_bookmark_remove.png => mobile/android/base/resources/drawable-mdpi-v9/ic_menu_bookmark_remove.png rename : embedding/android/resources/drawable-mdpi-v9/ic_menu_find_in_page.png => mobile/android/base/resources/drawable-mdpi-v9/ic_menu_find_in_page.png rename : embedding/android/resources/drawable-mdpi-v9/ic_menu_forward.png => mobile/android/base/resources/drawable-mdpi-v9/ic_menu_forward.png rename : embedding/android/resources/drawable-mdpi-v9/ic_menu_reload.png => mobile/android/base/resources/drawable-mdpi-v9/ic_menu_reload.png rename : embedding/android/resources/drawable-mdpi-v9/ic_menu_save_as_pdf.png => mobile/android/base/resources/drawable-mdpi-v9/ic_menu_save_as_pdf.png rename : embedding/android/resources/drawable-mdpi-v9/ic_menu_share.png => mobile/android/base/resources/drawable-mdpi-v9/ic_menu_share.png rename : embedding/android/resources/drawable-xhdpi-v11/address_bar_url_bg.9.png => mobile/android/base/resources/drawable-xhdpi-v11/address_bar_url_bg.9.png rename : embedding/android/resources/drawable-xhdpi-v11/ic_menu_bookmark_add.png => mobile/android/base/resources/drawable-xhdpi-v11/ic_menu_bookmark_add.png rename : embedding/android/resources/drawable-xhdpi-v11/ic_menu_bookmark_remove.png => mobile/android/base/resources/drawable-xhdpi-v11/ic_menu_bookmark_remove.png rename : embedding/android/resources/drawable-xhdpi-v11/ic_menu_find_in_page.png => mobile/android/base/resources/drawable-xhdpi-v11/ic_menu_find_in_page.png rename : embedding/android/resources/drawable-xhdpi-v11/ic_menu_foward.png => mobile/android/base/resources/drawable-xhdpi-v11/ic_menu_foward.png rename : embedding/android/resources/drawable-xhdpi-v11/ic_menu_reload.png => mobile/android/base/resources/drawable-xhdpi-v11/ic_menu_reload.png rename : embedding/android/resources/drawable-xhdpi-v11/ic_menu_save_as_pdf.png => mobile/android/base/resources/drawable-xhdpi-v11/ic_menu_save_as_pdf.png rename : embedding/android/resources/drawable-xhdpi-v11/ic_menu_share.png => mobile/android/base/resources/drawable-xhdpi-v11/ic_menu_share.png rename : embedding/android/resources/drawable-xhdpi-v11/tabs_more.png => mobile/android/base/resources/drawable-xhdpi-v11/tabs_more.png rename : embedding/android/resources/drawable-xhdpi-v11/tabs_normal.png => mobile/android/base/resources/drawable-xhdpi-v11/tabs_normal.png rename : embedding/android/resources/drawable-xhdpi-v11/tabs_plus.png => mobile/android/base/resources/drawable-xhdpi-v11/tabs_plus.png rename : embedding/android/resources/drawable-xhdpi-v11/tabs_pressed.png => mobile/android/base/resources/drawable-xhdpi-v11/tabs_pressed.png rename : embedding/android/resources/drawable/address_bar_bg.xml => mobile/android/base/resources/drawable/address_bar_bg.xml rename : embedding/android/resources/drawable/address_bar_url_default.xml => mobile/android/base/resources/drawable/address_bar_url_default.xml rename : embedding/android/resources/drawable/address_bar_url_pressed.xml => mobile/android/base/resources/drawable/address_bar_url_pressed.xml rename : embedding/android/resources/drawable/awesomebar_tab_focus.xml => mobile/android/base/resources/drawable/awesomebar_tab_focus.xml rename : embedding/android/resources/drawable/awesomebar_tab_focus_selected.xml => mobile/android/base/resources/drawable/awesomebar_tab_focus_selected.xml rename : embedding/android/resources/drawable/awesomebar_tab_indicator.xml => mobile/android/base/resources/drawable/awesomebar_tab_indicator.xml rename : embedding/android/resources/drawable/awesomebar_tab_press.xml => mobile/android/base/resources/drawable/awesomebar_tab_press.xml rename : embedding/android/resources/drawable/awesomebar_tab_press_selected.xml => mobile/android/base/resources/drawable/awesomebar_tab_press_selected.xml rename : embedding/android/resources/drawable/awesomebar_tab_selected.xml => mobile/android/base/resources/drawable/awesomebar_tab_selected.xml rename : embedding/android/resources/drawable/awesomebar_tab_unselected.xml => mobile/android/base/resources/drawable/awesomebar_tab_unselected.xml rename : embedding/android/resources/drawable/checkerboard.png => mobile/android/base/resources/drawable/checkerboard.png rename : embedding/android/resources/drawable/crash_reporter.png => mobile/android/base/resources/drawable/crash_reporter.png rename : embedding/android/resources/drawable/desktop_notification.png => mobile/android/base/resources/drawable/desktop_notification.png rename : embedding/android/resources/drawable/favicon.png => mobile/android/base/resources/drawable/favicon.png rename : embedding/android/resources/drawable/progress_spinner.xml => mobile/android/base/resources/drawable/progress_spinner.xml rename : embedding/android/resources/drawable/progress_spinner_1.png => mobile/android/base/resources/drawable/progress_spinner_1.png rename : embedding/android/resources/drawable/progress_spinner_10.png => mobile/android/base/resources/drawable/progress_spinner_10.png rename : embedding/android/resources/drawable/progress_spinner_11.png => mobile/android/base/resources/drawable/progress_spinner_11.png rename : embedding/android/resources/drawable/progress_spinner_12.png => mobile/android/base/resources/drawable/progress_spinner_12.png rename : embedding/android/resources/drawable/progress_spinner_13.png => mobile/android/base/resources/drawable/progress_spinner_13.png rename : embedding/android/resources/drawable/progress_spinner_14.png => mobile/android/base/resources/drawable/progress_spinner_14.png rename : embedding/android/resources/drawable/progress_spinner_15.png => mobile/android/base/resources/drawable/progress_spinner_15.png rename : embedding/android/resources/drawable/progress_spinner_16.png => mobile/android/base/resources/drawable/progress_spinner_16.png rename : embedding/android/resources/drawable/progress_spinner_17.png => mobile/android/base/resources/drawable/progress_spinner_17.png rename : embedding/android/resources/drawable/progress_spinner_18.png => mobile/android/base/resources/drawable/progress_spinner_18.png rename : embedding/android/resources/drawable/progress_spinner_2.png => mobile/android/base/resources/drawable/progress_spinner_2.png rename : embedding/android/resources/drawable/progress_spinner_3.png => mobile/android/base/resources/drawable/progress_spinner_3.png rename : embedding/android/resources/drawable/progress_spinner_4.png => mobile/android/base/resources/drawable/progress_spinner_4.png rename : embedding/android/resources/drawable/progress_spinner_5.png => mobile/android/base/resources/drawable/progress_spinner_5.png rename : embedding/android/resources/drawable/progress_spinner_6.png => mobile/android/base/resources/drawable/progress_spinner_6.png rename : embedding/android/resources/drawable/progress_spinner_7.png => mobile/android/base/resources/drawable/progress_spinner_7.png rename : embedding/android/resources/drawable/progress_spinner_8.png => mobile/android/base/resources/drawable/progress_spinner_8.png rename : embedding/android/resources/drawable/progress_spinner_9.png => mobile/android/base/resources/drawable/progress_spinner_9.png rename : embedding/android/resources/drawable/shadow.png => mobile/android/base/resources/drawable/shadow.png rename : embedding/android/resources/drawable/site_security_level.xml => mobile/android/base/resources/drawable/site_security_level.xml rename : embedding/android/resources/drawable/start.png => mobile/android/base/resources/drawable/start.png rename : embedding/android/resources/drawable/tab_close.png => mobile/android/base/resources/drawable/tab_close.png rename : embedding/android/resources/drawable/tab_new.png => mobile/android/base/resources/drawable/tab_new.png rename : embedding/android/resources/drawable/tabs_button.xml => mobile/android/base/resources/drawable/tabs_button.xml rename : embedding/android/resources/drawable/tabs_level.xml => mobile/android/base/resources/drawable/tabs_level.xml rename : embedding/android/resources/drawable/tabs_tray_bg.9.png => mobile/android/base/resources/drawable/tabs_tray_bg.9.png rename : embedding/android/resources/layout/awesomebar_header_row.xml => mobile/android/base/resources/layout/awesomebar_header_row.xml rename : embedding/android/resources/layout/awesomebar_row.xml => mobile/android/base/resources/layout/awesomebar_row.xml rename : embedding/android/resources/layout/awesomebar_search.xml => mobile/android/base/resources/layout/awesomebar_search.xml rename : embedding/android/resources/layout/awesomebar_tab_indicator.xml => mobile/android/base/resources/layout/awesomebar_tab_indicator.xml rename : embedding/android/resources/layout/awesomebar_tabs.xml => mobile/android/base/resources/layout/awesomebar_tabs.xml rename : embedding/android/resources/layout/browser_toolbar.xml => mobile/android/base/resources/layout/browser_toolbar.xml rename : embedding/android/resources/layout/crash_reporter.xml => mobile/android/base/resources/layout/crash_reporter.xml rename : embedding/android/resources/layout/doorhanger.xml => mobile/android/base/resources/layout/doorhanger.xml rename : embedding/android/resources/layout/doorhangerpopup.xml => mobile/android/base/resources/layout/doorhangerpopup.xml rename : embedding/android/resources/layout/gecko_app.xml => mobile/android/base/resources/layout/gecko_app.xml rename : embedding/android/resources/layout/gecko_menu.xml => mobile/android/base/resources/layout/gecko_menu.xml rename : embedding/android/resources/layout/launch_app_list.xml => mobile/android/base/resources/layout/launch_app_list.xml rename : embedding/android/resources/layout/launch_app_listitem.xml => mobile/android/base/resources/layout/launch_app_listitem.xml rename : embedding/android/resources/layout/list_item_header.xml => mobile/android/base/resources/layout/list_item_header.xml rename : embedding/android/resources/layout/notification_icon_text.xml => mobile/android/base/resources/layout/notification_icon_text.xml rename : embedding/android/resources/layout/notification_progress.xml => mobile/android/base/resources/layout/notification_progress.xml rename : embedding/android/resources/layout/notification_progress_text.xml => mobile/android/base/resources/layout/notification_progress_text.xml rename : embedding/android/resources/layout/select_dialog_list.xml => mobile/android/base/resources/layout/select_dialog_list.xml rename : embedding/android/resources/layout/tabs_row.xml => mobile/android/base/resources/layout/tabs_row.xml rename : embedding/android/resources/layout/tabs_tray.xml => mobile/android/base/resources/layout/tabs_tray.xml rename : embedding/android/resources/values/arrays.xml => mobile/android/base/resources/values/arrays.xml rename : embedding/android/resources/values/colors.xml => mobile/android/base/resources/values/colors.xml rename : embedding/android/resources/values/styles.xml => mobile/android/base/resources/values/styles.xml rename : embedding/android/resources/values/themes.xml => mobile/android/base/resources/values/themes.xml rename : embedding/android/resources/xml/preferences.xml => mobile/android/base/resources/xml/preferences.xml rename : embedding/android/strings.xml.in => mobile/android/base/strings.xml.in rename : embedding/android/ui/PanZoomController.java => mobile/android/base/ui/PanZoomController.java rename : embedding/android/ui/ViewportController.java => mobile/android/base/ui/ViewportController.java
2011-11-18 10:28:17 -08:00
/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Android code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Wes Johnston <wjohnston@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
package org.mozilla.gecko;
import java.io.*;
import java.util.List;
import java.util.concurrent.SynchronousQueue;
import android.util.Log;
import java.lang.String;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.view.View;
import android.view.ViewGroup;
import android.view.LayoutInflater;
import android.view.ViewGroup.LayoutParams;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.TextView;
import android.widget.CheckBox;
import android.widget.CheckedTextView;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.Spinner;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.DialogInterface.OnCancelListener;
import android.content.DialogInterface.OnMultiChoiceClickListener;
import org.json.JSONArray;
import org.json.JSONObject;
import android.text.method.PasswordTransformationMethod;
import android.graphics.Color;
import android.text.InputType;
import android.app.AlertDialog;
public class PromptService implements OnClickListener, OnCancelListener, OnItemClickListener {
private static final String LOGTAG = "GeckoPromptService";
private PromptInput[] mInputs;
private AlertDialog mDialog = null;
private class PromptButton {
public String label = "";
PromptButton(JSONObject aJSONButton) {
try {
label = aJSONButton.getString("label");
} catch(Exception ex) { }
}
}
private class PromptInput {
private String label = "";
private String type = "";
private String hint = "";
private JSONObject mJSONInput = null;
private View view = null;
public PromptInput(JSONObject aJSONInput) {
mJSONInput = aJSONInput;
try {
label = aJSONInput.getString("label");
} catch(Exception ex) { }
try {
type = aJSONInput.getString("type");
} catch(Exception ex) { }
try {
hint = aJSONInput.getString("hint");
} catch(Exception ex) { }
}
public View getView() {
if (type.equals("checkbox")) {
CheckBox checkbox = new CheckBox(GeckoApp.mAppContext);
checkbox.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
checkbox.setText(label);
try {
Boolean value = mJSONInput.getBoolean("checked");
checkbox.setChecked(value);
} catch(Exception ex) { }
view = (View)checkbox;
} else if (type.equals("textbox") || this.type.equals("password")) {
EditText input = new EditText(GeckoApp.mAppContext);
int inputtype = InputType.TYPE_CLASS_TEXT;
if (type.equals("password")) {
inputtype |= InputType.TYPE_TEXT_VARIATION_PASSWORD | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS;
}
input.setInputType(inputtype);
try {
String value = mJSONInput.getString("value");
input.setText(value);
} catch(Exception ex) { }
if (!hint.equals("")) {
input.setHint(hint);
}
view = (View)input;
} else if (type.equals("menulist")) {
Spinner spinner = new Spinner(GeckoApp.mAppContext);
try {
String[] listitems = getStringArray(mJSONInput, "values");
if (listitems.length > 0) {
ArrayAdapter<String> adapter = new ArrayAdapter<String>(GeckoApp.mAppContext, android.R.layout.simple_dropdown_item_1line, listitems);
spinner.setAdapter(adapter);
}
} catch(Exception ex) { }
view = (View)spinner;
}
return view;
}
public String getName() {
return type;
}
public String getValue() {
if (this.type.equals("checkbox")) {
CheckBox checkbox = (CheckBox)view;
return checkbox.isChecked() ? "true" : "false";
} else if (type.equals("textbox") || type.equals("password")) {
EditText edit = (EditText)view;
return edit.getText().toString();
} else if (type.equals("menulist")) {
Spinner spinner = (Spinner)view;
return Integer.toString(spinner.getSelectedItemPosition());
}
return "";
}
}
public void Show(String aTitle, String aText, PromptButton[] aButtons, PromptListItem[] aMenuList, boolean aMultipleSelection) {
AlertDialog.Builder builder = new AlertDialog.Builder(GeckoApp.mAppContext);
if (!aTitle.equals("")) {
builder.setTitle(aTitle);
}
if (!aText.equals("")) {
builder.setMessage(aText);
}
int length = mInputs.length;
if (aMenuList.length > 0) {
int resourceId = android.R.layout.select_dialog_item;
if (mSelected != null && mSelected.length > 0) {
if (aMultipleSelection) {
resourceId = android.R.layout.select_dialog_multichoice;
} else {
resourceId = android.R.layout.select_dialog_singlechoice;
}
}
PromptListAdapter adapter = new PromptListAdapter(GeckoApp.mAppContext, resourceId, aMenuList);
if (mSelected != null && mSelected.length > 0) {
if (aMultipleSelection) {
LayoutInflater inflater = GeckoApp.mAppContext.getLayoutInflater();
adapter.listView = (ListView) inflater.inflate(R.layout.select_dialog_list, null);
adapter.listView.setOnItemClickListener(this);
builder.setInverseBackgroundForced(true);
adapter.listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
adapter.listView.setAdapter(adapter);
builder.setView(adapter.listView);
} else {
int selectedIndex = -1;
for (int i = 0; i < mSelected.length; i++) {
if (mSelected[i]) {
selectedIndex = i;
break;
}
}
mSelected = null;
builder.setSingleChoiceItems(adapter, selectedIndex, this);
}
} else {
builder.setAdapter(adapter, this);
mSelected = null;
}
} else if (length == 1) {
builder.setView(mInputs[0].getView());
} else if (length > 1) {
LinearLayout linearLayout = new LinearLayout(GeckoApp.mAppContext);
linearLayout.setOrientation(LinearLayout.VERTICAL);
for (int i = 0; i < length; i++) {
View content = mInputs[i].getView();
linearLayout.addView(content);
}
builder.setView((View)linearLayout);
}
length = aButtons.length;
if (length > 0) {
builder.setPositiveButton(aButtons[0].label, this);
}
if (length > 1) {
builder.setNeutralButton(aButtons[1].label, this);
}
if (length > 2) {
builder.setNegativeButton(aButtons[2].label, this);
}
mDialog = builder.create();
mDialog.setOnCancelListener(this);
mDialog.show();
}
public void onClick(DialogInterface aDialog, int aWhich) {
JSONObject ret = new JSONObject();
try {
int button = -1;
ListView list = mDialog.getListView();
if (list != null || mSelected != null) {
button = aWhich;
if (mSelected != null) {
JSONArray selected = new JSONArray();
for (int i = 0; i < mSelected.length; i++) {
selected.put(mSelected[i]);
}
ret.put("button", selected);
} else {
ret.put("button", button);
}
} else {
switch(aWhich) {
case DialogInterface.BUTTON_POSITIVE : button = 0; break;
case DialogInterface.BUTTON_NEUTRAL : button = 1; break;
case DialogInterface.BUTTON_NEGATIVE : button = 2; break;
}
ret.put("button", button);
}
if (mInputs != null) {
for (int i = 0; i < mInputs.length; i++) {
ret.put(mInputs[i].getName(), mInputs[i].getValue());
}
}
} catch(Exception ex) {
Log.i(LOGTAG, "Error building return: " + ex);
}
if (mDialog != null) {
mDialog.dismiss();
}
finishDialog(ret.toString());
}
private boolean[] mSelected = null;
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
mSelected[position] = !mSelected[position];
}
public void onCancel(DialogInterface aDialog) {
JSONObject ret = new JSONObject();
try {
ret.put("button", -1);
} catch(Exception ex) { }
finishDialog(ret.toString());
}
public void finishDialog(String aReturn) {
mInputs = null;
mDialog = null;
mSelected = null;
try {
GeckoAppShell.sPromptQueue.put(aReturn);
} catch(Exception ex) { }
}
public void processMessage(JSONObject geckoObject) {
String title = "";
try {
title = geckoObject.getString("title");
} catch(Exception ex) { }
String text = "";
try {
text = geckoObject.getString("text");
} catch(Exception ex) { }
JSONArray buttons = new JSONArray();
try {
buttons = geckoObject.getJSONArray("buttons");
} catch(Exception ex) { }
int length = buttons.length();
PromptButton[] promptbuttons = new PromptButton[length];
for (int i = 0; i < length; i++) {
try {
promptbuttons[i] = new PromptButton(buttons.getJSONObject(i));
} catch(Exception ex) { }
}
JSONArray inputs = new JSONArray();
try {
inputs = geckoObject.getJSONArray("inputs");
} catch(Exception ex) { }
length = inputs.length();
mInputs = new PromptInput[length];
for (int i = 0; i < length; i++) {
try {
mInputs[i] = new PromptInput(inputs.getJSONObject(i));
} catch(Exception ex) { }
}
PromptListItem[] menuitems = getListItemArray(geckoObject, "listitems");
mSelected = getBooleanArray(geckoObject, "selected");
boolean multiple = false;
try {
multiple = geckoObject.getBoolean("multiple");
} catch(Exception ex) { }
this.Show(title, text, promptbuttons, menuitems, multiple);
}
private String[] getStringArray(JSONObject aObject, String aName) {
JSONArray items = new JSONArray();
try {
items = aObject.getJSONArray(aName);
} catch(Exception ex) { }
int length = items.length();
String[] list = new String[length];
for (int i = 0; i < length; i++) {
try {
list[i] = items.getString(i);
} catch(Exception ex) { }
}
return list;
}
private boolean[] getBooleanArray(JSONObject aObject, String aName) {
JSONArray items = new JSONArray();
try {
items = aObject.getJSONArray(aName);
} catch(Exception ex) { return null; }
int length = items.length();
boolean[] list = new boolean[length];
for (int i = 0; i < length; i++) {
try {
list[i] = items.getBoolean(i);
} catch(Exception ex) { }
}
return list;
}
private PromptListItem[] getListItemArray(JSONObject aObject, String aName) {
JSONArray items = new JSONArray();
try {
items = aObject.getJSONArray(aName);
} catch(Exception ex) { }
int length = items.length();
PromptListItem[] list = new PromptListItem[length];
for (int i = 0; i < length; i++) {
try {
list[i] = new PromptListItem(items.getJSONObject(i));
} catch(Exception ex) { }
}
return list;
}
private class PromptListItem {
public String label = "";
public boolean isGroup = false;
public boolean inGroup = false;
public boolean disabled = false;
public int id = 0;
PromptListItem(JSONObject aObject) {
try { label = aObject.getString("label"); } catch(Exception ex) { }
try { isGroup = aObject.getBoolean("isGroup"); } catch(Exception ex) { }
try { inGroup = aObject.getBoolean("inGroup"); } catch(Exception ex) { }
try { disabled = aObject.getBoolean("disabled"); } catch(Exception ex) { }
try { id = aObject.getInt("id"); } catch(Exception ex) { }
}
}
public class PromptListAdapter extends ArrayAdapter<PromptListItem> {
public ListView listView = null;
private PromptListItem[] mList;
private int mResourceId = -1;
PromptListAdapter(Context context, int textViewResourceId, PromptListItem[] objects) {
super(context, textViewResourceId, objects);
mList = objects;
mResourceId = textViewResourceId;
}
public int getCount() {
return mList.length;
}
public PromptListItem getItem(int position) {
return mList[position];
}
public long getItemId(int position) {
return mList[position].id;
}
public View getView(int position, View convertView, ViewGroup parent) {
PromptListItem item = getItem(position);
int resourceId = mResourceId;
if (item.isGroup) {
resourceId = R.layout.list_item_header;
}
LayoutInflater inflater = GeckoApp.mAppContext.getLayoutInflater();
View row = inflater.inflate(resourceId, null);
if (!item.isGroup){
try {
CheckedTextView ct = (CheckedTextView)row.findViewById(android.R.id.text1);
if (ct != null){
ct.setEnabled(!item.disabled);
ct.setClickable(item.disabled);
// Apparently just using ct.setChecked(true) doesn't work, so this
// is stolen from the android source code as a way to set the checked
// state of these items
if (mSelected[position] && listView != null) {
listView.setItemChecked(position, true);
}
}
} catch (Exception ex) { }
}
TextView t1 = (TextView) row.findViewById(android.R.id.text1);
if (t1 != null) {
t1.setText(item.label);
}
return row;
}
}
}