Fix buggy selection logic. Changed behaviour to always launch the selection's containing page.

This commit is contained in:
burke.davey
2012-01-17 03:56:52 +00:00
parent d29c735edb
commit 3a9b26df8d
2 changed files with 8 additions and 14 deletions

View File

@@ -92,14 +92,9 @@ public class C2DMReceiver extends C2DMBaseReceiver {
} catch (ActivityNotFoundException e) {
return;
}
} else {
if (sel != null && sel.length() > 0) { // have selection
LauncherUtils.generateNotification(context, sel,
context.getString(R.string.copied_desktop_clipboard), launchIntent);
} else {
LauncherUtils.generateNotification(context, url, title, launchIntent);
}
}
// Record history (for link/maps only)
if (launchIntent != null && launchIntent.getAction().equals(Intent.ACTION_VIEW)) {

View File

@@ -27,14 +27,6 @@ public class LauncherUtils {
intent = new Intent(Intent.ACTION_DIAL,
Uri.parse("tel:" + number));
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
ClipboardManager cm =
(ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
cm.setText(number);
} else if (sel != null && sel.length() > 0) {
// No intent for selection - just copy to clipboard
ClipboardManager cm =
(ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
cm.setText(sel);
} else {
intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
@@ -49,6 +41,13 @@ public class LauncherUtils {
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}
}
if (sel != null && sel.length() > 0) {
ClipboardManager cm =
(ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
cm.setText(sel);
}
return intent;
}