summaryrefslogtreecommitdiffstats
path: root/src/com/android/calendar/Utils.java
diff options
context:
space:
mode:
authorErik <roboerik@android.com>2010-02-24 14:46:03 -0800
committerErik <roboerik@android.com>2010-02-26 10:47:05 -0800
commit1ef7f3ae2831dce8fa5e350f78ac4258c1a0a605 (patch)
tree1f1c9ede474016cc2b678825e33550172f45a681 /src/com/android/calendar/Utils.java
parent4a8bc461b908ef32851d1dc1b73c20b7282d10d8 (diff)
downloadandroid_packages_apps_Calendar-1ef7f3ae2831dce8fa5e350f78ac4258c1a0a605.tar.gz
android_packages_apps_Calendar-1ef7f3ae2831dce8fa5e350f78ac4258c1a0a605.tar.bz2
android_packages_apps_Calendar-1ef7f3ae2831dce8fa5e350f78ac4258c1a0a605.zip
b/2412594 Added an implicit intent filter to the Calendar Launcher.
Added an implicent intent filter to the Calendar launcher so it will no longer be tied to the package name. And added functionality to allow a data uri to be passed giving a time to start the calendar at as well as allowing "VIEW" as an extra with "DAY" to go to the day view directly.
Diffstat (limited to 'src/com/android/calendar/Utils.java')
-rw-r--r--src/com/android/calendar/Utils.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/com/android/calendar/Utils.java b/src/com/android/calendar/Utils.java
index 7dd3da2c..72947141 100644
--- a/src/com/android/calendar/Utils.java
+++ b/src/com/android/calendar/Utils.java
@@ -21,12 +21,15 @@ import static android.provider.Calendar.EVENT_BEGIN_TIME;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
+import android.net.Uri;
import android.preference.PreferenceManager;
import android.text.format.Time;
+import android.util.Log;
import android.view.animation.AlphaAnimation;
import android.widget.ViewFlipper;
import java.util.Calendar;
+import java.util.List;
public class Utils {
public static void startActivity(Context context, String className, long time) {
@@ -79,7 +82,19 @@ public class Utils {
*/
public static final long timeFromIntentInMillis(Intent intent) {
// If the time was specified, then use that. Otherwise, use the current time.
+ Uri data = intent.getData();
long millis = intent.getLongExtra(EVENT_BEGIN_TIME, -1);
+ if (millis == -1 && data != null && data.isHierarchical()) {
+ List<String> path = data.getPathSegments();
+ if(path.size() == 3 && path.get(1).equals("time")) {
+ try {
+ millis = Long.valueOf(data.getLastPathSegment());
+ } catch (NumberFormatException e) {
+ Log.i("Calendar", "timeFromIntentInMillis: Data existed but no valid time " +
+ "found. Using current time.");
+ }
+ }
+ }
if (millis == -1) {
millis = System.currentTimeMillis();
}