From 3a9b26df8d342c291b5a062d73f55dbb54012aae Mon Sep 17 00:00:00 2001 From: "burke.davey" Date: Tue, 17 Jan 2012 03:56:52 +0000 Subject: [PATCH] Fix buggy selection logic. Changed behaviour to always launch the selection's containing page. --- .../android/apps/chrometophone/C2DMReceiver.java | 7 +------ .../android/apps/chrometophone/LauncherUtils.java | 15 +++++++-------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/android/src/com/google/android/apps/chrometophone/C2DMReceiver.java b/android/src/com/google/android/apps/chrometophone/C2DMReceiver.java index 8655e5b..c8e5392 100644 --- a/android/src/com/google/android/apps/chrometophone/C2DMReceiver.java +++ b/android/src/com/google/android/apps/chrometophone/C2DMReceiver.java @@ -93,12 +93,7 @@ public class C2DMReceiver extends C2DMBaseReceiver { 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); - } + LauncherUtils.generateNotification(context, url, title, launchIntent); } // Record history (for link/maps only) diff --git a/android/src/com/google/android/apps/chrometophone/LauncherUtils.java b/android/src/com/google/android/apps/chrometophone/LauncherUtils.java index e29fc3a..30b8a3e 100644 --- a/android/src/com/google/android/apps/chrometophone/LauncherUtils.java +++ b/android/src/com/google/android/apps/chrometophone/LauncherUtils.java @@ -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; }