Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
halo
packages_apps_Calendar
Commits
2c7c851a
Commit
2c7c851a
authored
14 years ago
by
Michael Chan
Browse files
Options
Download
Email Patches
Plain Diff
b/3189042 Handle ACTION_VIEW in AllInOne. Removed EventInfoActivity.
Change-Id: Ic00300e5d48d264ade7d400d703cba8f5a2b8626
parent
7a30aa9f
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
71 additions
and
122 deletions
+71
-122
AndroidManifest.xml
AndroidManifest.xml
+5
-11
res/layout/event_info.xml
res/layout/event_info.xml
+0
-0
src/com/android/calendar/AllInOneActivity.java
src/com/android/calendar/AllInOneActivity.java
+59
-11
src/com/android/calendar/CalendarController.java
src/com/android/calendar/CalendarController.java
+1
-1
src/com/android/calendar/EventInfoActivity.java
src/com/android/calendar/EventInfoActivity.java
+0
-89
src/com/android/calendar/EventInfoFragment.java
src/com/android/calendar/EventInfoFragment.java
+3
-3
src/com/android/calendar/SearchActivity.java
src/com/android/calendar/SearchActivity.java
+1
-1
src/com/android/calendar/event/EditEventActivity.java
src/com/android/calendar/event/EditEventActivity.java
+1
-1
src/com/android/calendar/event/EditEventFragment.java
src/com/android/calendar/event/EditEventFragment.java
+1
-5
No files found.
AndroidManifest.xml
View file @
2c7c851a
...
...
@@ -65,6 +65,11 @@
<data
android:host=
"com.android.calendar"
/>
<data
android:scheme=
"content"
/>
</intent-filter>
<intent-filter>
<action
android:name=
"android.intent.action.VIEW"
/>
<category
android:name=
"android.intent.category.DEFAULT"
/>
<data
android:mimeType=
"vnd.android.cursor.item/event"
/>
</intent-filter>
</activity-alias>
<activity
android:name=
".event.EditEventActivity"
...
...
@@ -85,17 +90,6 @@
</intent-filter>
</activity-alias>
<activity
android:name=
"EventInfoActivity"
android:label=
"@string/event_info_title"
android:theme=
"@style/CalendarTheme.WithActionBar"
android:configChanges=
"orientation|keyboardHidden"
>
<intent-filter>
<action
android:name=
"android.intent.action.VIEW"
/>
<category
android:name=
"android.intent.category.DEFAULT"
/>
<data
android:mimeType=
"vnd.android.cursor.item/event"
/>
</intent-filter>
</activity>
<activity
android:name=
"GoogleCalendarUriIntentFilter"
android:label=
"@string/app_label"
android:theme=
"@android:style/Theme.Light"
android:configChanges=
"orientation|keyboardHidden"
>
...
...
This diff is collapsed.
Click to expand it.
res/layout/event_info
_activity
.xml
→
res/layout/event_info.xml
View file @
2c7c851a
File moved
This diff is collapsed.
Click to expand it.
src/com/android/calendar/AllInOneActivity.java
View file @
2c7c851a
...
...
@@ -18,12 +18,14 @@ package com.android.calendar;
import
static
android
.
provider
.
Calendar
.
EVENT_BEGIN_TIME
;
import
static
android
.
provider
.
Calendar
.
EVENT_END_TIME
;
import
static
android
.
provider
.
Calendar
.
AttendeesColumns
.
ATTENDEE_STATUS
;
import
com.android.calendar.CalendarController.EventHandler
;
import
com.android.calendar.CalendarController.EventInfo
;
import
com.android.calendar.CalendarController.EventType
;
import
com.android.calendar.CalendarController.ViewType
;
import
com.android.calendar.agenda.AgendaFragment
;
import
com.android.calendar.event.EditEventHelper
;
import
com.android.calendar.month.MonthByWeekFragment
;
import
com.android.calendar.selectcalendars.SelectCalendarsFragment
;
...
...
@@ -53,6 +55,7 @@ import android.view.View;
import
android.widget.SearchView
;
import
android.widget.TextView
;
import
java.util.List
;
import
java.util.Locale
;
import
java.util.TimeZone
;
...
...
@@ -77,6 +80,11 @@ public class AllInOneActivity extends Activity implements EventHandler,
private
TextView
mHomeTime
;
private
String
mTimeZone
;
private
long
mViewEventId
=
-
1
;
private
long
mIntentEventStartMillis
=
-
1
;
private
long
mIntentEventEndMillis
=
-
1
;
private
int
mIntentAttendeeResponse
=
EditEventHelper
.
ATTENDEE_NO_RESPONSE
;
// Action bar and Navigation bar (left side of Action bar)
private
ActionBar
mActionBar
;
private
ActionBar
.
Tab
mDayTab
;
...
...
@@ -112,28 +120,37 @@ public class AllInOneActivity extends Activity implements EventHandler,
// This needs to be created before setContentView
mController
=
CalendarController
.
getInstance
(
this
);
// Get time from intent or icicle
long
timeMillis
;
long
timeMillis
=
-
1
;
int
viewType
=
-
1
;
boolean
restoreEdit
=
false
;
final
Intent
intent
=
getIntent
();
if
(
icicle
!=
null
)
{
timeMillis
=
icicle
.
getLong
(
BUNDLE_KEY_RESTORE_TIME
);
}
else
{
timeMillis
=
Utils
.
timeFromIntentInMillis
(
getIntent
());
}
boolean
restoreEdit
=
icicle
!=
null
?
icicle
.
getBoolean
(
BUNDLE_KEY_RESTORE_EDIT
,
false
)
:
false
;
int
viewType
;
if
(
restoreEdit
)
{
restoreEdit
=
icicle
.
getBoolean
(
BUNDLE_KEY_RESTORE_EDIT
,
false
);
viewType
=
ViewType
.
EDIT
;
}
else
{
String
action
=
intent
.
getAction
();
if
(
Intent
.
ACTION_VIEW
.
equals
(
action
))
{
// Open EventInfo later
timeMillis
=
parseViewAction
(
intent
);
}
if
(
timeMillis
==
-
1
)
{
timeMillis
=
Utils
.
timeFromIntentInMillis
(
intent
);
}
}
if
(!
restoreEdit
)
{
viewType
=
Utils
.
getViewTypeFromIntentAndSharedPref
(
this
);
}
mTimeZone
=
Utils
.
getTimeZone
(
this
,
mHomeTimeUpdater
);
Time
t
=
new
Time
(
mTimeZone
);
t
.
set
(
timeMillis
);
if
(
icicle
!=
null
&&
getI
ntent
()
!=
null
)
{
Log
.
d
(
TAG
,
"both, icicle:"
+
icicle
.
toString
()
+
" intent:"
+
getI
ntent
()
.
toString
());
if
(
icicle
!=
null
&&
i
ntent
!=
null
)
{
Log
.
d
(
TAG
,
"both, icicle:"
+
icicle
.
toString
()
+
" intent:"
+
i
ntent
.
toString
());
}
else
{
Log
.
d
(
TAG
,
"not both, icicle:"
+
icicle
+
" intent:"
+
getI
ntent
()
);
Log
.
d
(
TAG
,
"not both, icicle:"
+
icicle
+
" intent:"
+
i
ntent
);
}
mIsMultipane
=
(
getResources
().
getConfiguration
().
screenLayout
...
...
@@ -163,6 +180,29 @@ public class AllInOneActivity extends Activity implements EventHandler,
mContentResolver
=
getContentResolver
();
}
private
long
parseViewAction
(
final
Intent
intent
)
{
long
timeMillis
=
-
1
;
Uri
data
=
intent
.
getData
();
if
(
data
!=
null
&&
data
.
isHierarchical
())
{
List
<
String
>
path
=
data
.
getPathSegments
();
if
(
path
.
size
()
==
2
&&
path
.
get
(
0
).
equals
(
"events"
))
{
try
{
mViewEventId
=
Long
.
valueOf
(
data
.
getLastPathSegment
());
if
(
mViewEventId
!=
-
1
)
{
mIntentEventStartMillis
=
intent
.
getLongExtra
(
EVENT_BEGIN_TIME
,
0
);
mIntentEventEndMillis
=
intent
.
getLongExtra
(
EVENT_END_TIME
,
0
);
mIntentAttendeeResponse
=
intent
.
getIntExtra
(
ATTENDEE_STATUS
,
EditEventHelper
.
ATTENDEE_NO_RESPONSE
);
timeMillis
=
mIntentEventStartMillis
;
}
}
catch
(
NumberFormatException
e
)
{
// Ignore if mViewEventId can't be parsed
}
}
}
return
timeMillis
;
}
private
void
configureActionBar
()
{
mActionBar
=
getActionBar
();
mActionBar
.
setTabNavigationMode
();
...
...
@@ -195,6 +235,14 @@ public class AllInOneActivity extends Activity implements EventHandler,
updateHomeClock
();
mPaused
=
false
;
mOnSaveInstanceStateCalled
=
false
;
if
(
mViewEventId
!=
-
1
&&
mIntentEventStartMillis
!=
-
1
&&
mIntentEventEndMillis
!=
-
1
)
{
mController
.
sendEventRelatedEvent
(
this
,
EventType
.
VIEW_EVENT
,
mViewEventId
,
mIntentEventStartMillis
,
mIntentEventEndMillis
,
-
1
,
-
1
);
mViewEventId
=
-
1
;
mIntentEventStartMillis
=
-
1
;
mIntentEventEndMillis
=
-
1
;
}
}
@Override
...
...
This diff is collapsed.
Click to expand it.
src/com/android/calendar/CalendarController.java
View file @
2c7c851a
...
...
@@ -454,7 +454,7 @@ public class CalendarController {
Intent
intent
=
new
Intent
(
Intent
.
ACTION_VIEW
);
Uri
eventUri
=
ContentUris
.
withAppendedId
(
Events
.
CONTENT_URI
,
eventId
);
intent
.
setData
(
eventUri
);
intent
.
setClassName
(
mContext
,
EventInfoActivity
.
class
.
getName
());
//
intent.setClassName(mContext, EventInfoActivity.class.getName());
intent
.
putExtra
(
EVENT_BEGIN_TIME
,
startMillis
);
intent
.
putExtra
(
EVENT_END_TIME
,
endMillis
);
mContext
.
startActivity
(
intent
);
...
...
This diff is collapsed.
Click to expand it.
src/com/android/calendar/EventInfoActivity.java
deleted
100644 → 0
View file @
7a30aa9f
/*
* Copyright (C) 2010 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com.android.calendar
;
import
static
android
.
provider
.
Calendar
.
EVENT_BEGIN_TIME
;
import
static
android
.
provider
.
Calendar
.
EVENT_END_TIME
;
import
static
android
.
provider
.
Calendar
.
AttendeesColumns
.
ATTENDEE_STATUS
;
import
com.android.calendar.CalendarController.EventInfo
;
import
com.android.calendar.CalendarController.EventType
;
import
android.app.Fragment
;
import
android.content.Intent
;
import
android.net.Uri
;
import
android.os.Bundle
;
import
android.text.format.Time
;
public
class
EventInfoActivity
extends
AbstractCalendarActivity
implements
CalendarController
.
EventHandler
{
private
static
final
int
HANDLER_KEY
=
0
;
static
final
int
ATTENDEE_NO_RESPONSE
=
-
1
;
private
DeleteEventHelper
mDeleteEventHelper
;
private
CalendarController
mController
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
// This needs to be created before setContentView
mController
=
CalendarController
.
getInstance
(
this
);
Intent
intent
=
getIntent
();
Uri
uri
=
intent
.
getData
();
long
startMillis
=
intent
.
getLongExtra
(
EVENT_BEGIN_TIME
,
0
);
long
endMillis
=
intent
.
getLongExtra
(
EVENT_END_TIME
,
0
);
int
attendeeResponseFromIntent
=
intent
.
getIntExtra
(
ATTENDEE_STATUS
,
ATTENDEE_NO_RESPONSE
);
Fragment
f
=
new
EventInfoFragment
(
uri
,
startMillis
,
endMillis
,
attendeeResponseFromIntent
);
getFragmentManager
().
openTransaction
().
add
(
android
.
R
.
id
.
content
,
f
).
commit
();
mDeleteEventHelper
=
new
DeleteEventHelper
(
this
,
this
,
true
/* exit when done */
);
mController
.
registerEventHandler
(
HANDLER_KEY
,
this
);
}
@Override
protected
void
onDestroy
()
{
super
.
onDestroy
();
CalendarController
.
removeInstance
(
this
);
}
@Override
public
void
eventsChanged
()
{
// TODO Auto-generated method stub
}
@Override
public
long
getSupportedEventTypes
()
{
return
EventType
.
DELETE_EVENT
;
}
@Override
public
void
handleEvent
(
EventInfo
event
)
{
if
(
event
.
eventType
==
EventType
.
DELETE_EVENT
)
{
long
endTime
=
(
event
.
endTime
==
null
)
?
-
1
:
event
.
endTime
.
toMillis
(
false
);
mDeleteEventHelper
.
delete
(
event
.
startTime
.
toMillis
(
false
),
endTime
,
event
.
id
,
-
1
);
}
}
}
This diff is collapsed.
Click to expand it.
src/com/android/calendar/EventInfoFragment.java
View file @
2c7c851a
...
...
@@ -78,7 +78,7 @@ public class EventInfoFragment extends DialogFragment implements OnCheckedChange
CalendarController
.
EventHandler
{
public
static
final
boolean
DEBUG
=
false
;
public
static
final
String
TAG
=
"EventInfo
Activity
"
;
public
static
final
String
TAG
=
"EventInfo
Fragment
"
;
private
static
final
String
BUNDLE_KEY_EVENT_ID
=
"key_event_id"
;
...
...
@@ -311,7 +311,7 @@ public class EventInfoFragment extends DialogFragment implements OnCheckedChange
public
EventInfoFragment
(
long
eventId
,
long
startMillis
,
long
endMillis
)
{
this
(
ContentUris
.
withAppendedId
(
Events
.
CONTENT_URI
,
eventId
),
startMillis
,
endMillis
,
E
ventInfoActivity
.
ATTENDEE_NO_RESPONSE
);
startMillis
,
endMillis
,
E
ditEventHelper
.
ATTENDEE_NO_RESPONSE
);
mEventId
=
eventId
;
}
...
...
@@ -389,7 +389,7 @@ public class EventInfoFragment extends DialogFragment implements OnCheckedChange
@Override
public
View
onCreateView
(
LayoutInflater
inflater
,
ViewGroup
container
,
Bundle
savedInstanceState
)
{
mView
=
inflater
.
inflate
(
R
.
layout
.
event_info
_activity
,
null
);
mView
=
inflater
.
inflate
(
R
.
layout
.
event_info
,
null
);
if
(
mUri
==
null
)
{
// restore event ID from bundle
...
...
This diff is collapsed.
Click to expand it.
src/com/android/calendar/SearchActivity.java
View file @
2c7c851a
...
...
@@ -170,7 +170,7 @@ public class SearchActivity extends Activity
Intent
intent
=
new
Intent
(
Intent
.
ACTION_VIEW
);
Uri
eventUri
=
ContentUris
.
withAppendedId
(
Events
.
CONTENT_URI
,
event
.
id
);
intent
.
setData
(
eventUri
);
intent
.
setClassName
(
this
,
EventInfoActivity
.
class
.
getName
());
//
intent.setClassName(this, EventInfoActivity.class.getName());
intent
.
putExtra
(
EVENT_BEGIN_TIME
,
event
.
startTime
!=
null
?
event
.
startTime
.
toMillis
(
true
)
:
-
1
);
intent
.
putExtra
(
...
...
This diff is collapsed.
Click to expand it.
src/com/android/calendar/event/EditEventActivity.java
View file @
2c7c851a
...
...
@@ -55,7 +55,7 @@ public class EditEventActivity extends AbstractCalendarActivity {
mEditFragment
=
(
EditEventFragment
)
getFragmentManager
().
findFragmentById
(
R
.
id
.
edit_event
);
if
(
mEditFragment
==
null
)
{
mEditFragment
=
new
EditEventFragment
(
mEventInfo
);
mEditFragment
=
new
EditEventFragment
(
mEventInfo
,
false
);
mEditFragment
.
mShowModifyDialogOnLaunch
=
getIntent
().
getBooleanExtra
(
CalendarController
.
EVENT_EDIT_ON_LAUNCH
,
false
);
...
...
This diff is collapsed.
Click to expand it.
src/com/android/calendar/event/EditEventFragment.java
View file @
2c7c851a
...
...
@@ -350,11 +350,7 @@ public class EditEventFragment extends Fragment implements EventHandler {
}
public
EditEventFragment
()
{
this
(
null
);
}
public
EditEventFragment
(
EventInfo
event
)
{
this
(
event
,
false
);
this
(
null
,
false
);
}
public
EditEventFragment
(
EventInfo
event
,
boolean
readOnly
)
{
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment