diff options
author | Scott Jackson <daneren2005@gmail.com> | 2013-07-07 16:33:47 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2013-07-07 16:33:47 -0700 |
commit | 3354beae4cccd747b3728b246dab6b0476491ea2 (patch) | |
tree | 36bf0502cbf60429591b2318d4155c8f9cfffeeb /subsonic-android/src/github/daneren2005 | |
parent | f798f0d85b6a595ee0b32ddc066441b84e5d483a (diff) | |
download | dsub-3354beae4cccd747b3728b246dab6b0476491ea2.tar.gz dsub-3354beae4cccd747b3728b246dab6b0476491ea2.tar.bz2 dsub-3354beae4cccd747b3728b246dab6b0476491ea2.zip |
Linkify URLs/emails in info dialogs
Diffstat (limited to 'subsonic-android/src/github/daneren2005')
-rw-r--r-- | subsonic-android/src/github/daneren2005/dsub/util/Util.java | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/subsonic-android/src/github/daneren2005/dsub/util/Util.java b/subsonic-android/src/github/daneren2005/dsub/util/Util.java index e909b4c8..a6fdd987 100644 --- a/subsonic-android/src/github/daneren2005/dsub/util/Util.java +++ b/subsonic-android/src/github/daneren2005/dsub/util/Util.java @@ -41,6 +41,9 @@ import android.os.Build; import android.os.Environment; import android.os.Handler; import android.support.v4.app.NotificationCompat; +import android.text.SpannableString; +import android.text.method.LinkMovementMethod; +import android.text.util.Linkify; import android.util.Log; import android.view.Gravity; import android.view.ViewGroup; @@ -797,17 +800,22 @@ public final class Util { showDialog(context, icon, context.getResources().getString(titleId), message); } private static void showDialog(Context context, int icon, String title, String message) { - new AlertDialog.Builder(context) - .setIcon(icon) - .setTitle(title) - .setMessage(message) - .setPositiveButton(R.string.common_ok, new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int i) { - dialog.dismiss(); - } - }) - .show(); + SpannableString ss = new SpannableString(message); + Linkify.addLinks(ss, Linkify.ALL); + + AlertDialog dialog = new AlertDialog.Builder(context) + .setIcon(icon) + .setTitle(title) + .setMessage(ss) + .setPositiveButton(R.string.common_ok, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int i) { + dialog.dismiss(); + } + }) + .show(); + + ((TextView)dialog.findViewById(android.R.id.message)).setMovementMethod(LinkMovementMethod.getInstance()); } public static void showPlayingNotification(final Context context, final DownloadServiceImpl downloadService, Handler handler, MusicDirectory.Entry song) { |