summaryrefslogtreecommitdiffstats
path: root/res
diff options
context:
space:
mode:
authorDaniel Sandler <dsandler@android.com>2010-04-27 16:57:25 -0400
committerDaniel Sandler <dsandler@android.com>2010-04-28 15:52:54 -0400
commitab1ebd7e6f10a352867d4e38ce6421a38b0f50d2 (patch)
treee57bc40cf7c3389fe81fdd1b940f31ab08ad8f43 /res
parent6ad7942740b95adfac0e274c3bdbf54925403dd7 (diff)
downloadandroid_packages_apps_Trebuchet-ab1ebd7e6f10a352867d4e38ce6421a38b0f50d2.tar.gz
android_packages_apps_Trebuchet-ab1ebd7e6f10a352867d4e38ce6421a38b0f50d2.tar.bz2
android_packages_apps_Trebuchet-ab1ebd7e6f10a352867d4e38ce6421a38b0f50d2.zip
Hotseats: better strategy for finding the default browser.
To do this, we invoke resolveActivity to see what activity would result from viewing an arbitrary (but valid) URL. If there's just one installed, or there are multiple and the user has chosen a default handler for http:, we take that component and launch it with CATEGORY_HOME (so as not to upset the URL in the frontmost window/tab/what-have-you). We also use this information to extract the localized name of the app, which is then installed into the hotseat as the contentDescription (for accessibility). If there's no default and multiple options are availble, we'll get the activity chooser instead. In this case, we just fire off that chooser and let the user pick an app (possibly setting a default along the way). Because the default may change, we reload all this hotseat information every time one of the hotseats is tapped. Another side-effect of this approach is that until there exists a default browser, the original URL will be sent to the activity the user chooses from the ResolveActivity. So we need a sensible default URL here; one can be found in R.string.default_browser_url (similar to Browser's R.string.homepage_base). This change also moves the hotseat intents and icons into arrays.xml for easier configuration. Change-Id: I06268df8b59e0f41f1f8b0e47f823db4c44ec761
Diffstat (limited to 'res')
-rw-r--r--res/values/arrays.xml11
-rw-r--r--res/values/strings.xml6
2 files changed, 17 insertions, 0 deletions
diff --git a/res/values/arrays.xml b/res/values/arrays.xml
new file mode 100644
index 000000000..1fcabb2f9
--- /dev/null
+++ b/res/values/arrays.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <string-array name="hotseats" translatable="false">
+ <item>intent:#Intent;action=android.intent.action.MAIN;component=com.android.contacts/.ContactsLaunchActivity;end</item>
+ <item>*BROWSER*</item>
+ </string-array>
+ <array name="hotseat_icons" translatable="false">
+ <item>@drawable/hotseat_phone</item>
+ <item>@drawable/hotseat_browser</item>
+ </array>
+</resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 73c6a8ae8..86c1b3c1f 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -141,4 +141,10 @@
<!-- Text to show user in place of a gadget when we can't display it properly -->
<string name="gadget_error_text">Problem loading widget</string>
+ <!-- URL to use when detecting the current default browser.
+ Attempts to mimic homepage_base in Browser; {CID} should be replaced
+ by the client-id, e.g. "android-google". -->
+ <string name="default_browser_url" translatable="false">
+ http://www.google.com/m?client=ms-{CID}&amp;source=android-home-hotseat</string>
+
</resources>