diff --git a/res/layout/fragment_about.xml b/res/layout/fragment_about.xml index c35b12cae938a315a1540de8f0dd6a0cf0bfe47f..cacec4686102030bda808155d2c4b1a21ce76a95 100644 --- a/res/layout/fragment_about.xml +++ b/res/layout/fragment_about.xml @@ -26,10 +26,10 @@ android:textStyle="bold" /> <TextView + android:id="@+id/url_project" android:layout_width="match_parent" android:layout_height="match_parent" - android:text="@string/url_project" - android:autoLink="web" /> + android:text="@string/url_project" /> <TextView android:layout_width="match_parent" @@ -38,10 +38,10 @@ android:textStyle="bold" /> <TextView + android:id="@+id/url_android_bugs" android:layout_width="match_parent" android:layout_height="match_parent" - android:text="@string/url_android_forum" - android:autoLink="web" /> + android:text="@string/url_android_forum" /> <TextView android:layout_width="match_parent" @@ -55,10 +55,10 @@ android:text="@string/about_volunteer" /> <TextView + android:id="@+id/url_android_volunteer" android:layout_width="match_parent" android:layout_height="match_parent" - android:text="@string/url_android_forum" - android:autoLink="web" /> + android:text="@string/url_android_forum" /> <TextView android:layout_width="match_parent" @@ -66,10 +66,10 @@ android:text="@string/about_donate" /> <TextView + android:id="@+id/url_donate" android:layout_width="match_parent" android:layout_height="match_parent" - android:text="@string/url_donate" - android:autoLink="web" /> + android:text="@string/url_donate" /> </LinearLayout> diff --git a/res/values/strings.xml b/res/values/strings.xml index 9371f128a201f75ede2755d30ee081531ab4d8f6..dab79f4c2730ac088c5913c9f16994d0c11cbd25 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -107,13 +107,13 @@ <string name="menu_about">About</string> <string name="about_version">Version:</string> <string name="about_project">Project Home:</string> - <string name="url_project" translatable="false">https://geti2p.net/</string> + <string name="url_project" translatable="false">https://geti2p.net | http://i2p-projekt.i2p</string> <string name="about_bugs">Bugs and Support:</string> - <string name="url_android_forum" translatable="false">http://zzz.i2p/</string> + <string name="url_android_forum" translatable="false">http://zzz.i2p</string> <string name="about_helpwanted">Help Wanted!</string> <string name="about_volunteer">Want to help make the app better? Volunteer on the Android forum:</string> <string name="about_donate">Want to donate money or bitcoins to buy more Android devices for development and testing? Go to:</string> - <string name="url_donate" translatable="false">https://geti2p.net/en/donate</string> + <string name="url_donate" translatable="false">https://geti2p.net/en/donate | http://i2p-projekt.i2p/en/donate</string> <string name="menu_help">Help</string> diff --git a/src/net/i2p/android/router/AboutDialog.java b/src/net/i2p/android/router/AboutDialog.java index 3bb432659686155f0bead50548d7921ca133e7b6..e2e2d9bcffc911331723871c9626a2ef221a6e28 100644 --- a/src/net/i2p/android/router/AboutDialog.java +++ b/src/net/i2p/android/router/AboutDialog.java @@ -1,11 +1,13 @@ package net.i2p.android.router; import net.i2p.android.router.R; +import net.i2p.android.router.util.I2Patterns; import net.i2p.android.router.util.Util; import android.app.AlertDialog; import android.app.Dialog; import android.os.Bundle; import android.support.v4.app.DialogFragment; +import android.text.util.Linkify; import android.view.LayoutInflater; import android.view.View; import android.widget.TextView; @@ -20,6 +22,15 @@ public class AboutDialog extends DialogFragment { TextView tv = (TextView)view.findViewById(R.id.about_version); tv.setText(currentVersion); + tv = (TextView)view.findViewById(R.id.url_project); + Linkify.addLinks(tv, I2Patterns.I2P_WEB_URL, "http://"); + tv = (TextView)view.findViewById(R.id.url_android_bugs); + Linkify.addLinks(tv, I2Patterns.I2P_WEB_URL, "http://"); + tv = (TextView)view.findViewById(R.id.url_android_volunteer); + Linkify.addLinks(tv, I2Patterns.I2P_WEB_URL, "http://"); + tv = (TextView)view.findViewById(R.id.url_donate); + Linkify.addLinks(tv, I2Patterns.I2P_WEB_URL, "http://"); + AlertDialog.Builder b = new AlertDialog.Builder(getActivity()); b.setTitle(R.string.menu_about) .setView(view); diff --git a/src/net/i2p/android/router/util/I2Patterns.java b/src/net/i2p/android/router/util/I2Patterns.java new file mode 100644 index 0000000000000000000000000000000000000000..827e533be010ba4c625e2fdcbf8377d6853a6e7b --- /dev/null +++ b/src/net/i2p/android/router/util/I2Patterns.java @@ -0,0 +1,43 @@ +package net.i2p.android.router.util; + +import java.util.regex.Pattern; + +import android.util.Patterns; + +public class I2Patterns { + /** + * The double-parentheses are needed because the included + * pattern has an additional closing parenthesis. + */ + public static final String I2P_TOP_LEVEL_DOMAIN_STR_FOR_WEB_URL = + "(?:(" + + Patterns.TOP_LEVEL_DOMAIN_STR_FOR_WEB_URL + + "|i2p))"; + + /** + * Regular expression pattern to match most part of RFC 3987 + * Internationalized URLs, aka IRIs. Commonly used Unicode characters are + * added. + * Copied from android.util.Patterns + */ + public static final Pattern I2P_WEB_URL = Pattern.compile( + "((?:(http|https|Http|Https|rtsp|Rtsp):\\/\\/(?:(?:[a-zA-Z0-9\\$\\-\\_\\.\\+\\!\\*\\'\\(\\)" + + "\\,\\;\\?\\&\\=]|(?:\\%[a-fA-F0-9]{2})){1,64}(?:\\:(?:[a-zA-Z0-9\\$\\-\\_" + + "\\.\\+\\!\\*\\'\\(\\)\\,\\;\\?\\&\\=]|(?:\\%[a-fA-F0-9]{2})){1,25})?\\@)?)?" + + "((?:(?:[" + Patterns.GOOD_IRI_CHAR + "][" + Patterns.GOOD_IRI_CHAR + "\\-]{0,64}\\.)+" // named host + + I2P_TOP_LEVEL_DOMAIN_STR_FOR_WEB_URL + + "|(?:(?:25[0-5]|2[0-4]" // or ip address + + "[0-9]|[0-1][0-9]{2}|[1-9][0-9]|[1-9])\\.(?:25[0-5]|2[0-4][0-9]" + + "|[0-1][0-9]{2}|[1-9][0-9]|[1-9]|0)\\.(?:25[0-5]|2[0-4][0-9]|[0-1]" + + "[0-9]{2}|[1-9][0-9]|[1-9]|0)\\.(?:25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}" + + "|[1-9][0-9]|[0-9])))" + + "(?:\\:\\d{1,5})?)" // plus option port number + + "(\\/(?:(?:[" + Patterns.GOOD_IRI_CHAR + "\\;\\/\\?\\:\\@\\&\\=\\#\\~" // plus option query params + + "\\-\\.\\+\\!\\*\\'\\(\\)\\,\\_])|(?:\\%[a-fA-F0-9]{2}))*)?" + + "(?:\\b|$)"); // and finally, a word boundary or end of + // input. This is to stop foo.sure from + // matching as foo.su + + private I2Patterns() { + } +}