diff --git a/astrid/res/layout/update_message_view.xml b/astrid/res/layout/update_message_view.xml
new file mode 100644
index 000000000..58b2b2dd4
--- /dev/null
+++ b/astrid/res/layout/update_message_view.xml
@@ -0,0 +1,54 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/astrid/src/com/todoroo/astrid/service/UpdateMessageService.java b/astrid/src/com/todoroo/astrid/service/UpdateMessageService.java
index 6fdce74eb..16b2751df 100644
--- a/astrid/src/com/todoroo/astrid/service/UpdateMessageService.java
+++ b/astrid/src/com/todoroo/astrid/service/UpdateMessageService.java
@@ -15,19 +15,16 @@ import org.json.JSONObject;
import org.weloveastrid.rmilk.MilkUtilities;
import android.app.Activity;
-import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
-import android.text.Spannable;
import android.text.TextUtils;
-import android.text.method.LinkMovementMethod;
-import android.text.style.ClickableSpan;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.WindowManager.BadTokenException;
+import android.widget.Button;
import android.widget.TextView;
import com.timsu.astrid.R;
@@ -40,7 +37,6 @@ import com.todoroo.andlib.service.RestClient;
import com.todoroo.andlib.sql.Query;
import com.todoroo.andlib.utility.AndroidUtilities;
import com.todoroo.andlib.utility.DialogUtilities;
-import com.todoroo.andlib.utility.Pair;
import com.todoroo.astrid.actfm.sync.ActFmPreferenceService;
import com.todoroo.astrid.dao.StoreObjectDao;
import com.todoroo.astrid.dao.StoreObjectDao.StoreObjectCriteria;
@@ -83,13 +79,19 @@ public class UpdateMessageService {
if(updates == null || updates.length() == 0)
return;
- Pair message = buildUpdateMessage(updates);
- if(message == null || message.getLeft().length() == 0)
+ MessageTuple message = buildUpdateMessage(updates);
+ if(message == null || message.message.length() == 0)
return;
displayUpdateDialog(message);
}
+ private static class MessageTuple {
+ public String message = null;
+ public String linkText = null;
+ public OnClickListener click = null;
+ }
+
private static interface DialogShower {
void showDialog(Activity activity);
}
@@ -109,33 +111,33 @@ public class UpdateMessageService {
}
}
- protected void displayUpdateDialog(final Pair message) {
+ protected void displayUpdateDialog(final MessageTuple message) {
if(activity == null)
return;
final DialogShower ds;
- if (message.getRight() != null) {
+ if (message.linkText != null) {
ds = new DialogShower() {
@Override
public void showDialog(Activity a) {
try {
- View view = activity.getLayoutInflater().inflate(R.layout.update_message_link, null);
- TextView messageView = (TextView) view.findViewById(R.id.update_message);
- messageView.setText(message.getLeft());
- messageView.setTextColor(activity.getResources().getColor(ThemeService.getDialogTextColor()));
-
- TextView linkView = (TextView) view.findViewById(R.id.update_link);
- linkView.setMovementMethod(LinkMovementMethod.getInstance());
- linkView.setText(message.getRight());
-
- final Dialog d = new AlertDialog.Builder(a)
- .setTitle(R.string.UpS_updates_title)
- .setView(view)
- .setPositiveButton(R.string.DLG_ok, null)
- .create();
- linkView.setOnClickListener(new OnClickListener() {
+ final Dialog d = new Dialog(activity, R.style.ReminderDialog);
+ d.setContentView(R.layout.update_message_view);
+ TextView messageView = (TextView) d.findViewById(R.id.reminder_message);
+ messageView.setText(message.message);
+ d.findViewById(R.id.dismiss).setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ d.dismiss();
+ }
+ });
+
+ Button linkButton = (Button) d.findViewById(R.id.ok);
+ linkButton.setText(message.linkText);
+ linkButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
+ message.click.onClick(v);
d.dismiss();
}
});
@@ -148,7 +150,7 @@ public class UpdateMessageService {
} else {
String color = ThemeService.getDialogTextColorString();
final String html = "" +
- message.getLeft() + "";
+ message.message + "