From 35d30e148e1ae907f91853cbec07590995ba624d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Tue, 16 Jul 2013 14:18:35 +0200 Subject: [PATCH] Disable text selection as it didn't allow links. Possible but wonky solution suggested in the source code comments. --- src/org/fdroid/fdroid/AppDetails.java | 28 +++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/src/org/fdroid/fdroid/AppDetails.java b/src/org/fdroid/fdroid/AppDetails.java index 3d6574d9e..58eae6989 100644 --- a/src/org/fdroid/fdroid/AppDetails.java +++ b/src/org/fdroid/fdroid/AppDetails.java @@ -303,12 +303,6 @@ public class AppDetails extends ListActivity { mInstalledSigID = old.mInstalledSigID; } - // Use the new textview select stuff only when available - private void setSelectable(TextView tv) { - if (Utils.hasApi(11)) - tv.setTextIsSelectable(true); - } - // Reset the display and list contents. Used when entering the activity, and // also when something has been installed/uninstalled. // Return true if the app was found, false otherwise. @@ -403,8 +397,27 @@ public class AppDetails extends ListActivity { tv = (TextView) findViewById(R.id.status); tv = (TextView) infoView.findViewById(R.id.description); + + /* + The following is a quick solution to enable both text selection and + links. Causes glitches and crashes: + java.lang.IndexOutOfBoundsException: setSpan (-1 ... -1) starts before 0 + + class CustomMovementMethod extends LinkMovementMethod { + @Override + public boolean canSelectArbitrarily () { + return true; + } + } + + if (Utils.hasApi(11)) + tv.setTextIsSelectable(true); + tv.setMovementMethod(new CustomMovementMethod()); + else + tv.setMovementMethod(LinkMovementMethod.getInstance()); + */ + tv.setMovementMethod(LinkMovementMethod.getInstance()); - setSelectable(tv); // Need this to add the unimplemented support for ordered and unordered // lists to Html.fromHtml(). @@ -441,7 +454,6 @@ public class AppDetails extends ListActivity { tv = (TextView) infoView.findViewById(R.id.summary); tv.setText(app.summary); - setSelectable(tv); tv = (TextView) infoView.findViewById(R.id.permissions_list);