Wesley Johnston: Action modes for Android |
Assuming all goes well, Firefox will soon be shipping with our first support for Android’s ActionModes for text selection. We previously allowed text selection via some special context menu options when people long pressed on selected text. This replaces that implementation with a nice new UI:
If you’ve got an add-on that adds something to the selected text context menu:
Some astute developers have already updated themselves, but adding support is pretty easy (updated MDN docs here). We’ve added two methods to the SelectionHandler
let actionId = SelectionHandler.addAction({ label: "My addon", id: "my_id", icon: "resource://myaddon/icon", // You MUST include an icon to be shown in the ActionBar,
// otherwise you'll always be put into the overflow menu. action: function(aElement) { // do something when clicked }, selector: {
// Just because this is being shown, doesn't mean there is a selection.
// We may just be showing the cursor handle to let you move the cursor position.
matches: function(aElement) { return SelectionHandler.isSelectionActive(); } } },
SelectionHandler.remove(actionId);
Text selection has had an exciting life in Firefox for Android, and is likely going to go through another transition as we land better platform support for touch friendly handles for not just Android, but also Firefox OS, and Metro Firefox. But this is a good move for the UI. We implemented it as a compatibility layer, so it should be available for all Android versions from Froyo to the newest KitKat devices.
http://digdug2k.wordpress.com/2013/12/20/action-modes-for-android/
Комментировать | « Пред. запись — К дневнику — След. запись » | Страницы: [1] [Новые] |