How to make image in imageView selectable in android? - imageview

I know it is possible to make text in textView selectable (for copy and paste) using android:textIsSelectable="true".
I want to make image in imageView selectable (for copy and paste as shown in the image below). Does anyone have a clue?

The Android OS does not support this natively. You will have to register your ImageView with registerForContextMenu. More info about context menus here.
Then you can get the ImageView's bitmap by doing ((BitmapDrawable)yourImageView.getDrawable()).getBitmap();
See here for more information on copying the bitmap onto the clipboard.
As a final comment I will say most Android users, myself included, would not expect to be able to long tap an image to copy it onto their clipboard unless there was some indication that it was possible in your app.

Related

JavaFX - How to run desktop app in the background using window close/minimize button and 'reopen or completely close' from hidden icons

I created a simple clipboard(desktop app) using JavaFX. Now I want to run the clipboard in the background when user minimizes or closes the app. For example, 'XAMPP' or 'μtorrent'. Of course, user can reopen or completely close the clipboard from hidden icons(in windows) or from the top panel(in ubuntu). From THIS question, i found
Platform.setImplicitExit(false);
which runs the clipboard in the background. But i want to show it in the hidden icons(in windows) so that i can reopen or completely close it from there.
I know how to get and modify the window OnCloseRequest. I just want to know what i should do to run the clipboard in the background.
I searched in the google and StackOverflow for any related tutorial or blog post but found nothing. Any suggestion will be highly appreciated.
I didn't share my code because my clipboard app has no problem. I just want to add the above-mentioned feature.

Javafx Read only HTMLEditor with copy functionality

Working with Java 8 HTMlEditors to show some content.
Now I want to make my content read only, in other words disable typing in the area. If I set property disabled to true this is achieved.
But the user is not able to copy some content from the field.
Is there a way that we can disable input but still can copy the content over.
Just used a webview for this and loaded the content onto that

Qt Screenshot sharing app - How to select the area of a screen

I am trying to code an app in Qt for capturing and then sharing the screenshots. For now my application captures the screenshot, shows a preview and saves it. I am yet to do the upload part. but before that I would like to be able to select the area of the screen of which the screenshot needs to be captured.
I tried searching and I couldn't find any helpful articles or documents in Qt. So can anyone help me?
PS: The idea is to create a similar app like lightshot and several other similar tools.
Thanks in advance
There are two methods that you can use for this: -
1) Capture an image of the screen and then display that, full screen to the user, essentially allowing the user to crop the image.
2) A more commonly used method is to create a full-screen, topmost window that has no title bar and is transparent. This allows the user to drag out an area, which you can draw an outline to represent the area the user requires.
I recommend the 2nd method and creating a transparent window is simply a matter of changing the window flags, as you can see here.

Download Image From Site

This site is claiming to prevent the download of images and preventing screenshots. Is this truly possible to stop and can anyone crack it in their demos? What tools can be used to download an image set as a background?
http://www.iptlock.com/how.php
It isn't possible, no.
If the client can see it on their screen, then it exists on their computer. Even if that weren't the case, there is always the whole analog thing (people can literally take a picture of their screen).
If you have chrome: Just go to one of their demos, press ctrl+shift+c, and an inspector will show up, showing you all individual parts of the page. Then select the image from the list (servedemoimg) , right mouse click on it, and you can save the jpg. It is not possible to prevent people from downloading those files. And this company doesn't even make it particularly difficult.
Their scheme "works" by hiding the content whenever a key is pressed or the main window loses focus. They also attempt to detect that something has been copied to the clipboard and they replace it with some text ("It is prohibited to copy distribute or in any way alter these copyrighted images").
That means that if you press any key to copy the content, you'll just get the "locked" graphic. The same goes for switching to another app (like a screen capture app) because the screen capture app will have focus instead of the browser, causing the lock graphic to show. If you do manage to copy something to the clipboard, it immediately replaces the content with the text I mentined above.
Furthermore, their content is a background image so you can't easily print or right-click to copy the image by disabling JS.
However, it's pretty trivial to defeat. My first attempt using IE8 was trivial. When I went to the "protected" page, IE asked me if I wanted to allow the page to access the clipboard, and I clicked "Don't Allow". Then I pressed PrntScr and was able to paste the content into another program. This worked because that particular key isn't captured by the browser and I didn't allow the page to see my clipboard.
Then I tried again, this time allowing clipboard access. This time I used a screen capture program that automatically captures the foreground window after a set time delay. This worked because I was able to give the browser window focus, and the screen capture utility just saved the image as a file instead of putting it on the clipboard.
Lastly, I just saved the source as a file and saw background:url(servedemoimg.php?filename=IPTbusiness_graphicdesign_ITB). Just putting http://www.iptlock.com/servedemoimg.php?filename=IPTbusiness_lawyer_ITB into my browser's address bar made the complete "protected" content show up for me to download, print, email, etc.

How to alter a PNG icon in Qt

The effect I wanted to achieve is something like the Mail icon in iPhone. There is a rounded rectangle on the topright corner of the Mail icon. The number inside the rectangle shows the current number of unread emails and can be dynamically changed when new emails come in. I am wondering if it is possible to do this using Qt 4.6 for a desktop application interface. If it is possible, what classes should I start to learn? (I guess Qt should have some bitmap manipulation class.) Thank you.
You can draw into a QImage or QPixmap using QPianter, then save the icon to a png file - or since you are using it in your app, just change the internal icon directly.
Take a look at QImage and QPainter.

Resources