Make privacy policy link clickable in sync settings.

Bug: 19361223
Change-Id: I83128d771bf5214a446afd6a3d5244a184d0a4a8
diff --git a/java/src/com/android/inputmethod/latin/settings/AccountsSettingsFragment.java b/java/src/com/android/inputmethod/latin/settings/AccountsSettingsFragment.java
index c7c2977..b734d8b 100644
--- a/java/src/com/android/inputmethod/latin/settings/AccountsSettingsFragment.java
+++ b/java/src/com/android/inputmethod/latin/settings/AccountsSettingsFragment.java
@@ -22,6 +22,7 @@
 import android.app.AlertDialog;
 import android.content.Context;
 import android.content.DialogInterface;
+import android.content.DialogInterface.OnShowListener;
 import android.content.SharedPreferences;
 import android.content.res.Resources;
 import android.os.AsyncTask;
@@ -32,7 +33,9 @@
 import android.preference.SwitchPreference;
 import android.preference.TwoStatePreference;
 import android.text.TextUtils;
+import android.text.method.LinkMovementMethod;
 import android.widget.ListView;
+import android.widget.TextView;
 import android.widget.Toast;
 
 import com.android.inputmethod.annotations.UsedForTesting;
@@ -363,7 +366,8 @@
     /**
      * Listens to events when user clicks on "Enable sync" feature.
      */
-    class EnableSyncClickListener implements Preference.OnPreferenceClickListener {
+    class EnableSyncClickListener implements OnShowListener, Preference.OnPreferenceClickListener {
+        // TODO(cvnguyen): Write tests.
         @Override
         public boolean onPreferenceClick(final Preference preference) {
             final TwoStatePreference syncPreference = (TwoStatePreference) preference;
@@ -393,9 +397,19 @@
                          })
                          .setNegativeButton(R.string.cloud_sync_cancel, null)
                          .create();
+                optInDialog.setOnShowListener(this);
                 optInDialog.show();
             }
             return true;
         }
+
+        @Override
+        public void onShow(DialogInterface dialog) {
+            TextView messageView = (TextView) ((AlertDialog) dialog).findViewById(
+                    android.R.id.message);
+            if (messageView != null) {
+                messageView.setMovementMethod(LinkMovementMethod.getInstance());
+            }
+        }
     }
 }