Long press an element to show the black options bubble(copy,forward..) like wtsapp? - ionic-framework

Can someone point me to the right direction of how to show options(copy, forward...) when I long press an element (a message in this case) like wtsapp/FB messenger?
I don't even know what keywords should I be searching...(tried modal, popover, action sheet)
Thanks.
Update:
I understand that I should use the on-hold gesture...I am specifically looking for the black option bubble to be shown. I don't know what it is called(not modal/pop up/ action sheet/popover/alert). Thanks.

you can use on-hold="myFunction()", check the link below
http://ionicframework.com/docs/api/directive/onHold/
and then use the $ionicActionSheet Service to do your logic, check the link below
http://ionicframework.com/docs/api/service/$ionicActionSheet/

on-hold event is your friend : http://ionicframework.com/docs/api/directive/onHold/
I think following Codepen example would help in accomplishing what you want to do:
Actionsheet : http://codepen.io/ionic/pen/jLylA
Also, have a look this thread on Ionic Forum before you start implementing, just to avoid any similar issue, plus, this thread got some CodePen examples, that your might find useful :
https://forum.ionicframework.com/t/displaying-actionsheet-on-a-long-press-aka-hold-event-problem/5663

You can implement long press with either on-hold and if you want to implement long press for buttons, try this directive from this link and a note on directive can be found here . You may need to use a custom action sheet ($ionicActionSheet) to implement the UIMenuController (iOS component) like feature.
.selectable{
-webkit-user-select: auto;
}
for selection and ion-content to overflow-scroll="true"

Related

How to find a button within <ul> and <li> via Proctractor?

I am new to automation, and my previous experiences were with non-Angular apps, thus i start to use Protractor.
I want to navigate throught the website, though cannot find the right selector.
The button is highlighted in red on the bottom of the screen:
I've tried below code among many:
element(by.name('Flota')).click()
or
element(by.css('.ng-tns-c11-5')).click()
element(by.css('div[title=Flota]'));
maybe you should target the <a> or <nb-icon> element instead?
Try the following locators:
using a:
element(by.css('.ng-tns-c11-16.ng-star-inserted.active'));
or nb-icon:
element(by.css('.menu-icon.ng-tns-c11-16.ng-star-inserted'));
Additionally, if you need to target the <span> element:
element(by.css('.ng-tns-c11-16.ng-star-inserted.active span'));
I suggest
by.css("a[title='Flota']") //if this is the button you are looking for
Since the shorter is locator - the better
your help was much appreciated!
Unfortunately, i tried all options you provided and didn't work, though i made additional trial and error runs.
The code i worked out is below, maybe it will help another newbie like me:
element.all(by.css('#menu-item ng-tns-c11-4 ng-star-inserted li')).click()

How would one implement a sliding 2 button menu like this from Lift?

http://imgur.com/3ZBCsDn
Can't post the image on the site but there it is.
I have been trying to find if this is a template or a separate nib file ala the page turn animation. Any help would be greatly appreciated.
That is called a UIActionSheet. It is created entirely in code, so it's limited to some pretty simple stuff (i.e. a few buttons, one of which is the cancel button, and one of which can be marked "destructive"). Just consult the documentation for the UIActionSheet class; it tells you all there is to know about it.
Also, here's the discussion in my book:
http://www.apeth.com/iOSBook/ch26.html#_action_sheet

Does Pinterest button have a callback?

I need to unlock content when someone shares the post with pinterest, and I can't find a callback function on pinterest button. Is there any way to do this?
You could wrap the pinterest link with a span and add a jQuery click event to the span to at least know that the pinit button was clicked. That's about the best you can do until they release a real callback so you can know that an item was actually pinned.
<span id="pin-container"><a data-pin-config="beside" href="http://pinterest.com/pin/create/button/?url=[your_url]&media=[your_image]&description=[your_desc]" data-pin-do="buttonPin" ><img src="//assets.pinterest.com/images/pidgets/pin_it_button.png" /></a></span>
$('#pin-container').click(function () {
alert('clicked pin button');
});
A workaround is posted here:
http://www.lunametrics.com/blog/2012/03/12/tracking-pinterest-event-tracking/
Until Pinterest opens up a public API and a non-iFrame tracking button, this is about as good as you'll get.
As said before, the API is not public yet. The best workaround (I just tested it, and it works in my scenario) that I've found so far is http://www.seomoves.org/blog/tools/tracking-pins-with-the-pinterest-button-2595/
That link only lets you determine if the Pin Button was clicked, not if they actually made the share. Hope that helps a little!

Providing un-intrusive messages on an iPhone

This is kind of a silly question, but I cannot find the answer as I don't know the terms with which to search for it.
I am looking for a simple way of giving a 'status' message like 'Data updated' to the user without necessarily interrupting what he/she is doing (but have a option I guess in some instances to tab it an perform an action).
For example; some Apps give a rounded square semi-transparent with 'Lock screen/rotation' when an iPhone is rotated, I am look for something similar (or like the square box 'Build Complete in Xcode 4').
Is there an easy way of doing this?
Thanks a million in advance!
https://github.com/myell0w/MTStatusBarOverlay
MTStatusBarOverlay adds very subtle text to the phone's status bar. If you're looking for something a little more noticiable, try:
https://github.com/jdg/MBProgressHUD
As #kubi has pointed out, MTStatusBarOverlay is a good one, and I've passed Apple reviewer inspection with it. However I just found something that looks fraking awesome...
Tweetbot-Like Alert Panels (Blog), and the repository is MKInfoPanelDemo at Github.
Create a view that shows your message nicely, add it to the window, and start a UIView animation which makes it fade away. In the animation ended handler (delegate or block) remove the view.

How to Create the Highlight/Note Popup Buttons from the iPhone Kindle

I am wondering how Amazon did the highlight/note popup buttons in the Kindle app. After reading about UIPasteboard, UIMenuController, UIResponder, and UIResponderStandardEditActions, I am able to turn on or off standard edit actions (i.e. copy, cut, paste, select, and selectAll). However I haven't found a way to add a custom action yet. I would really appreciate it if I could get a pointer.
Thanks in advance!
Chris
(source: sampletheweb.com)
Edited by balexandre (added image instead link)
It looks like Amazon implemented their own custom view that mimicked the appearance of UIMenuController. I believe they did this rather than use SPI because if you click and hold on the Highlight cell, the arrow does not highlight, when it does in the real UIMenuController.
I don’t think there is a public interface to these controls, you’d probably have to code them yourself. (Or maybe figure out the private API, but that’s a slippery slope.) I am not sure about that, though, maybe somebody will prove me wrong.
That's a good point about the arrow part of the Notes/Highlight popup menu not highlighting, so they must be implementing their own.
However they are also obviously using a UIWebView, because it's recognizing tap and hold and they can highlight the text, and you can't get touch events from a UIWebView, much less get the information about what's selected. So how are they doing that?
This would be very useful for us to be able to do as well.
Use DTMenuController http://www.drobnik.com/touch/2010/01/dr-touchs-parts-store/
Costs 100 EUR ^_^
Custom menu items can be added via the UIMenuController's menuItems property. See Apple's UIMenuController docs.
the javascript part can be managed with jQuery, that's a fair simple and powerful library. i'm using it for resizing and rearranging things in a webview and it works great :)