Fixed a crash that could occur when processing update messages

pull/14/head
Sam Bosley 12 years ago
parent 0de8e7ca4b
commit c515902223

@ -109,23 +109,25 @@ public class UpdateMessageService {
} }
} }
protected void displayUpdateDialog(Pair<String, Spannable> message) { protected void displayUpdateDialog(final Pair<String, Spannable> message) {
if(activity == null) if(activity == null)
return; return;
final DialogShower ds; final DialogShower ds;
if (message.getRight() != null) { if (message.getRight() != null) {
final View view = activity.getLayoutInflater().inflate(R.layout.update_message_link, 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); TextView messageView = (TextView) view.findViewById(R.id.update_message);
messageView.setText(message.getLeft()); messageView.setText(message.getLeft());
messageView.setTextColor(activity.getResources().getColor(ThemeService.getDialogTextColor())); messageView.setTextColor(activity.getResources().getColor(ThemeService.getDialogTextColor()));
final TextView linkView = (TextView) view.findViewById(R.id.update_link); TextView linkView = (TextView) view.findViewById(R.id.update_link);
linkView.setMovementMethod(LinkMovementMethod.getInstance()); linkView.setMovementMethod(LinkMovementMethod.getInstance());
linkView.setText(message.getRight()); linkView.setText(message.getRight());
ds = new DialogShower() {
@Override
public void showDialog(Activity a) {
final Dialog d = new AlertDialog.Builder(a) final Dialog d = new AlertDialog.Builder(a)
.setTitle(R.string.UpS_updates_title) .setTitle(R.string.UpS_updates_title)
.setView(view) .setView(view)
@ -138,6 +140,9 @@ public class UpdateMessageService {
} }
}); });
d.show(); d.show();
} catch (Exception e) {
// This should never ever crash
}
} }
}; };
} else { } else {

Loading…
Cancel
Save