Highlight text on a PDF - android

I have compiled MuPDF correctly and have been able to run the sample app without an issue, but:
Problem
I want to have a functionality like highlights,underlines, sticky notes, arrows, lines, ovals, rectangles, freehand drawings and text boxes on which user long pressed by his finger, as in RepliGo PDF Reader pdf reader and others.
I searched a lot, but didn't find any relevant way, link or hint to achieve the desired feature.
Can someone share any idea on how to achieve the aforementioned functionality?
It would be even more helpful if someone can explain it by sharing some code or example.

As MuPdf doesn't expose apis for the features you require, I suggest using the PDFTron sdk library for android.
As you can see on their docs page, it supports lot of annotation related pdf features:
Ready-to-Use Tools for Rapid Development - including support for
advanced features such as text selection, full text search; links;
bookmark navigation and manipulation; interactive forms; various
annotation capabilities to enable PDF markup (text highlight,
underline, strikeout, squiggly, line, rectangle, ellipse, arrow,
sticky note, and free-hand tool mode, etc.).
http://www.pdftron.com/pdfnet/mobile/android_pdf_library.html

Related

Is there a resource for developing a custom gif keyboard for Android?

I am trying to develop a custom gif keyboard for my company with very little experience. I want to pull gif images from our company server into a simple gif keyboard so that our marketers can text gifs to accounts. So far I have found information on
developing an IME: https://developer.android.com/develop/ui/views/touch-and-input/creating-input-method#java
adding image support:https://developer.android.com/develop/ui/views/touch-and-input/image-keyboard#kotlin
setting up a content provider:https://developer.android.com/guide/topics/providers/create-document-provider
and even sample code for a Commit Content Sample IME
I really am just needing some basic code to generate a gif keyboard like the image in the developer documentation, but am not quite finding the resources necessary to achieve that.
Example of Image Keyboard
I feel like I've got all the pieces but no instructions for how to assemble them. Any guidance would be greatly appreciated.
Specifically, I'm not sure how to code to access my content provider in the Commit Content Sample IME sample code. What code do I use and where does it go?

Icon Next to the Search Orb in Android TV App

How can I add an icon next to the search orb, just as displayed below? I'd like to display a login page when the user clicks on the icon.
You can't, if you want to use the standard widgets offered by the Leanback library, such as BrowseFragment.
There is a way of creating your own version of the BrowseFragment widget, so that it is fully customizable and you can add as many buttons as you like, but it is definitely not easy to do. I've written a series of posts on this subject, which you can find here:
Building for Android TV
There is also a demo project that already gives you a starting point for the custom interface. The code can be found on this GitHub repo (episode_4 is probably what you're looking for).

How to apply android:textIsSelectable option for MuPDF viewer?

How to get the copy and paste selection in MuPdf.
I want to get like this below image.
Let me start with my standard spiel...
MuPDF is, at heart, a portable C library for opening/manipulating/rendering PDF (and other) file formats. It provides a C level API. Provided with the MuPDF library are various tools (such as PDF manipulation/rendering utilities, and example viewers for various different platforms).
As far as possible all the 'smarts' for these tools are encapsulated within the core library, and the tools themselves are thin veneers over this core functionality.
The Android viewer is one such example of this. The UI is written in Java, and it calls down to the core using a set of JNI functions to do all the file opening/page selection/rendering etc.
Now onto your question:
The logic for text selection already exists within MuPDF. Open a PDF, then from the top bar select the rightmost icon "(v)" to see more options. Choose the "Copy to clipboard" option from here.
Then you can drag your finger across the area of text you want selected. It will be highlighted on screen. Then click the tick icon in the top bar to finalise.
You can then swap app and paste the text out again. (All this assumes that the PDF has been built in a reasonable way so we can figure out what unicode char each glyph on the page corresponds to).
What MuPDF doesn't offer are the selection 'end tags' that you can drag with your finger. If you want that, you'll need to alter the android viewer specific java classes yourself. You shouldn't need to make any changes within the MuPDF core to support what you want. You might possibly need to tweak the JNI classes a bit.
It's probably not a huge job for a competent Android app developer, but it's too large for us to provide detailed information on a Stack Overflow answer.
If you have more questions, please don't hesitate to come visit us in the #ghostscript irc channel on freenode (see www.mupdf.com for a web link you can use if you don't have an irc client set up).

What do they utilize to build android apps with custom graphics and controls ?

What I mean to say while you're just getting started with the development and say you add a slider theres a predefined skin for that and you can place it somewhere on the screen, but in some apps there are things like a knob in a place of slider which you can rotate to do the same stuff what the slider does . How do they do that, does it require openGL or something I am not asking for a complete tutorial or something just curious on what stuff goes into building such thing
Mostly, if something is not provided out of the box, you will have to build your own control.
For example, you mention a Knob. That isn't available in the Android SDK. Such a control could prove to be useful.
Here is a tutorial to build such a custom Control: http://go-lambda.blogspot.in/2012/02/rotary-knob-widget-on-android.html
This is an image of the final result from the tutorial linked above:
Here is an example of a custom slider / seek bar: http://permadi.com/blog/2011/11/android-sdk-custom-slider-bar-seekbar/
This should give you a rough idea on how to go about creating your own custom views.
And finally, what I personally find the best possible resource for keeping track of almost all good Custom Views is here: http://www.androidviews.net/
The androidviews.net website has shut down. Android Arsenal is a new website that lists several third party Android libraries.

How to code Android for the visually impaired?

Does Android support visually impaired users in the same way as HTML alt tags are used to provide input for screen readers on the web?
If so, what is the best practice to code Buttons and ImageViews etc so they can be read by a screen reader?
I'm not quite clear on your question. The internet browser, or any applications that rely heavily on HTML rendering are not accessible This quote is taken from this blog post.
You can turn on the accessibility features by going to Settings --> Accessibility and checking the box "Accessibility". While the web browser and browser-based
applications do not yet "talk" using these enhancements, we're working on them for upcoming releases.
Android does provide screen reader support for a lot of applications, see this wiki page for a list of applications known to work well with Android using a free and open source screen reader.
I can't find any general guidelines for creating accessible apps but this LinkedIn group may be helpful. I don't have a LinkedIn account though so don't know how active the group is.
The best resource I've found on the Android Accessibility API is this code walk through: https://sites.google.com/site/gdevelopercodelabs/android/accessibility
See http://developer.android.com/guide/practices/design/accessibility.html for plenty of details on writing an accessible app.
The nearest equivalent to HTML's ALT is the contentDescription property - set in code or in XML.
If you are creating you own custom control, you'll need to do a bit more work to specify other details too; more details at the link above.
Most important thing: when you're done, test with TalkBack, the free Android screenreader from Google. (It's pre-installed on some Android models, but you can download from Android Market if you don't already have it.) You should be able to navigate to all the interactive elements in your app using the directional pad alone, and TalkBack should read out appropriate values for all elements as it does so. (It should pick up the contentDescription and read it out here.)
One thing to watch for is that from what I remember, the screenreader only reads out things that you can navigate to, so if you have instructional text on the page, it may not read out, so you may need to ensure that the contentDescription for other controls is suitably descriptive. To be sure, test with TalkBack, and see for you self (er, hear for yourself!) if what is read out makes sense.
(As noted in one of the other replies, although Android has an accessibility API, the Android browser doesn't actually support it (yet), so HTML pages - even properly marked up HTML code - isn't accessible on Android using the default browser. There are a couple of 3rd party browsers that add accessibility to HTML, though, such as the free IDEAL Web Reader app, which appears to wrap the Android HTML control and then add voicing on top of it. Hopefully Android will make their default browser fully accessible in some later release...)

Categories

Resources