This repository has been archived by the owner on Jan 14, 2022. It is now read-only.
Clickable URLs in Android Terminal Emulator #276
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Now works for links on current screen. Does not yet work for multi-line links, or if you scroll up.
Very nice! Thanks! |
Thanks for adding this feature, it's greatly appreciated. I've noticed that it appears to only support http:// URLs and not https:// ones? Would it be possible to add HTTPS support to this? |
Hi Chris, That's odd. I just tested it with an https:// URL and it worked for me. Can you describe the conditions that led to the failure in a little more detail? Thanks, |
Sorry, yes it it working fine, I was simply holding my finger over the https:// URL for too long and then getting the select text options. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
(c) 2013 Kendall Stewart
This pull request contains code to implement clickable URLs in Android Terminal Emulator.
The general idea is that the
EmulatorView
class now contains a data structure calledmLinkLayer
, to store potential URLs at each row/column position on the current view. The data structure is cleared every timeupdateSize
is called (so, when the size is actually changed, or when something a new character is drawn to the screen, etc), and lines of links are parsed one line at a time by a method calledcreateLinks
, which is called by theonDraw
method after a line of text is drawn.createLinks
supports multi-line-wrap links, and works by getting the Transcript line at the row being drawn, checking if its wrap flag is set, and concatenating multiple rows together if necessary. The result is then turned into aSpannableString
, and URLs are matched using theLinkify
class.The resulting URLs are then painted into
mLinkLayer
at the location of the text, such that they can be retrieved by touching the screen anywhere on the link. Retrieval is handled by thegetURLat
method, which converts screen coordinates into matrix coordinates, and then returns the link at that location, if any.To handle touch events, the
onSingleTapUp
method of the Term class has been updated to check for links at the tap location. AnexecURL
method has also been added to create an Intent that allows the URL to be opened by a web browser, etc.Other changes:
TranscriptScreen
class to facilitate getting data fromUnicodeTranscript
toEmulatorView
mAboutToAutoWrap
flag becomes true. This may be a kludge; I am not sure if it has side-effects.Issues: