diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/calendar/CalendarSettingsActivity.java | 6 | ||||
-rw-r--r-- | src/com/android/calendar/Utils.java | 9 | ||||
-rw-r--r-- | src/com/android/calendar/alerts/AlertReceiver.java | 16 | ||||
-rw-r--r-- | src/com/android/calendar/alerts/AlertUtils.java | 6 | ||||
-rw-r--r-- | src/com/android/calendar/event/EditEventFragment.java | 38 | ||||
-rw-r--r-- | src/com/android/calendar/event/EditEventView.java | 9 |
6 files changed, 54 insertions, 30 deletions
diff --git a/src/com/android/calendar/CalendarSettingsActivity.java b/src/com/android/calendar/CalendarSettingsActivity.java index 0584521f..a864b532 100644 --- a/src/com/android/calendar/CalendarSettingsActivity.java +++ b/src/com/android/calendar/CalendarSettingsActivity.java @@ -112,6 +112,12 @@ public class CalendarSettingsActivity extends PreferenceActivity { super.onPause(); } + @Override + protected boolean isValidFragment(String fragmentName) { + // This activity is not exported so we can just approve everything + return true; + } + Runnable mCheckAccounts = new Runnable() { @Override public void run() { diff --git a/src/com/android/calendar/Utils.java b/src/com/android/calendar/Utils.java index fc409cd4..40a9e58d 100644 --- a/src/com/android/calendar/Utils.java +++ b/src/com/android/calendar/Utils.java @@ -207,6 +207,15 @@ public class Utils { return Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN; } + /** + * Returns whether the SDK is the KeyLimePie release or later. + */ + public static boolean isKeyLimePieOrLater() { + // TODO when SDK is set to 19, switch back to this: +// return Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR2; + return "KeyLimePie".equals(Build.VERSION.CODENAME); + } + public static int getViewTypeFromIntentAndSharedPref(Activity activity) { Intent intent = activity.getIntent(); Bundle extras = intent.getExtras(); diff --git a/src/com/android/calendar/alerts/AlertReceiver.java b/src/com/android/calendar/alerts/AlertReceiver.java index 481619d9..83dcc9fc 100644 --- a/src/com/android/calendar/alerts/AlertReceiver.java +++ b/src/com/android/calendar/alerts/AlertReceiver.java @@ -417,8 +417,7 @@ public class AlertReceiver extends BroadcastReceiver { priority, true); if (Utils.isJellybeanOrLater()) { // Create a new-style expanded notification - Notification.BigTextStyle expandedBuilder = new Notification.BigTextStyle( - basicBuilder); + Notification.BigTextStyle expandedBuilder = new Notification.BigTextStyle(); if (description != null) { description = mBlankLinePattern.matcher(description).replaceAll(""); description = description.trim(); @@ -436,7 +435,8 @@ public class AlertReceiver extends BroadcastReceiver { text = stringBuilder; } expandedBuilder.bigText(text); - notification = expandedBuilder.build(); + basicBuilder.setStyle(expandedBuilder); + notification = basicBuilder.build(); } return new NotificationWrapper(notification, notificationId, eventId, startMillis, endMillis, doPopup); @@ -495,8 +495,7 @@ public class AlertReceiver extends BroadcastReceiver { if (expandable) { // Multiple reminders. Combine into an expanded digest notification. - Notification.InboxStyle expandedBuilder = new Notification.InboxStyle( - notificationBuilder); + Notification.InboxStyle expandedBuilder = new Notification.InboxStyle(); int i = 0; for (AlertService.NotificationInfo info : notificationInfos) { if (i < NOTIFICATION_DIGEST_MAX_LENGTH) { @@ -541,11 +540,10 @@ public class AlertReceiver extends BroadcastReceiver { // Remove the title in the expanded form (redundant with the listed items). expandedBuilder.setBigContentTitle(""); - - n = expandedBuilder.build(); - } else { - n = notificationBuilder.build(); + notificationBuilder.setStyle(expandedBuilder); } + + n = notificationBuilder.build(); } else { // Old-style notification (pre-JB). We only need a standard notification (no // buttons) but use a custom view so it is consistent with the others. diff --git a/src/com/android/calendar/alerts/AlertUtils.java b/src/com/android/calendar/alerts/AlertUtils.java index a082fdf7..fec7b111 100644 --- a/src/com/android/calendar/alerts/AlertUtils.java +++ b/src/com/android/calendar/alerts/AlertUtils.java @@ -88,7 +88,11 @@ public class AlertUtils { return new AlarmManagerInterface() { @Override public void set(int type, long triggerAtMillis, PendingIntent operation) { - mgr.set(type, triggerAtMillis, operation); + if (Utils.isKeyLimePieOrLater()) { + mgr.setExact(type, triggerAtMillis, operation); + } else { + mgr.set(type, triggerAtMillis, operation); + } } }; } diff --git a/src/com/android/calendar/event/EditEventFragment.java b/src/com/android/calendar/event/EditEventFragment.java index e1d59f8e..2c966e94 100644 --- a/src/com/android/calendar/event/EditEventFragment.java +++ b/src/com/android/calendar/event/EditEventFragment.java @@ -126,7 +126,7 @@ public class EditEventFragment extends Fragment implements EventHandler, OnColor private EventColorPickerDialog mColorPickerDialog; - private Activity mContext; + private Activity mActivity; private final Done mOnDone = new Done(); private boolean mSaveOnDetach = true; @@ -545,7 +545,7 @@ public class EditEventFragment extends Fragment implements EventHandler, OnColor @Override public void onAttach(Activity activity) { super.onAttach(activity); - mContext = activity; + mActivity = activity; mHelper = new EditEventHelper(activity, null); mHandler = new QueryHandler(activity.getContentResolver()); @@ -553,7 +553,7 @@ public class EditEventFragment extends Fragment implements EventHandler, OnColor mInputMethodManager = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE); - mUseCustomActionBar = !Utils.getConfigBool(mContext, R.bool.multiple_pane_config); + mUseCustomActionBar = !Utils.getConfigBool(mActivity, R.bool.multiple_pane_config); } @Override @@ -566,19 +566,19 @@ public class EditEventFragment extends Fragment implements EventHandler, OnColor } else { view = inflater.inflate(R.layout.edit_event, null); } - mView = new EditEventView(mContext, view, mOnDone, mTimeSelectedWasStartTime, + mView = new EditEventView(mActivity, view, mOnDone, mTimeSelectedWasStartTime, mDateSelectedWasStartDate); startQuery(); if (mUseCustomActionBar) { View actionBarButtons = inflater.inflate(R.layout.edit_event_custom_actionbar, - new LinearLayout(mContext), false); + new LinearLayout(mActivity), false); View cancelActionView = actionBarButtons.findViewById(R.id.action_cancel); cancelActionView.setOnClickListener(mActionBarListener); View doneActionView = actionBarButtons.findViewById(R.id.action_done); doneActionView.setOnClickListener(mActionBarListener); - mContext.getActionBar().setCustomView(actionBarButtons); + mActivity.getActionBar().setCustomView(actionBarButtons); } return view; @@ -589,7 +589,7 @@ public class EditEventFragment extends Fragment implements EventHandler, OnColor super.onDestroyView(); if (mUseCustomActionBar) { - mContext.getActionBar().setCustomView(null); + mActivity.getActionBar().setCustomView(null); } } @@ -702,7 +702,7 @@ public class EditEventFragment extends Fragment implements EventHandler, OnColor service.startUpdate(0, null, uri, values, null, null, 0); } - Toast.makeText(mContext, R.string.saving_event, Toast.LENGTH_SHORT).show(); + Toast.makeText(mActivity, R.string.saving_event, Toast.LENGTH_SHORT).show(); } protected void displayEditWhichDialog() { @@ -728,13 +728,13 @@ public class EditEventFragment extends Fragment implements EventHandler, OnColor } else { items = new CharSequence[3]; } - items[itemIndex++] = mContext.getText(R.string.modify_event); + items[itemIndex++] = mActivity.getText(R.string.modify_event); } - items[itemIndex++] = mContext.getText(R.string.modify_all); + items[itemIndex++] = mActivity.getText(R.string.modify_all); // Do one more check to make sure this remains at the end of the list if (!isFirstEventInSeries) { - items[itemIndex++] = mContext.getText(R.string.modify_all_following); + items[itemIndex++] = mActivity.getText(R.string.modify_all_following); } // Display the modification dialog. @@ -742,7 +742,7 @@ public class EditEventFragment extends Fragment implements EventHandler, OnColor mModifyDialog.dismiss(); mModifyDialog = null; } - mModifyDialog = new AlertDialog.Builder(mContext).setTitle(R.string.edit_event_label) + mModifyDialog = new AlertDialog.Builder(mActivity).setTitle(R.string.edit_event_label) .setItems(items, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { @@ -818,9 +818,9 @@ public class EditEventFragment extends Fragment implements EventHandler, OnColor stringResource = R.string.creating_event; } } - Toast.makeText(mContext, stringResource, Toast.LENGTH_SHORT).show(); + Toast.makeText(mActivity, stringResource, Toast.LENGTH_SHORT).show(); } else if ((mCode & Utils.DONE_SAVE) != 0 && mModel != null && isEmptyNewEvent()) { - Toast.makeText(mContext, R.string.empty_event, Toast.LENGTH_SHORT).show(); + Toast.makeText(mActivity, R.string.empty_event, Toast.LENGTH_SHORT).show(); } if ((mCode & Utils.DONE_DELETE) != 0 && mOriginalModel != null @@ -840,7 +840,7 @@ public class EditEventFragment extends Fragment implements EventHandler, OnColor break; } DeleteEventHelper deleteHelper = new DeleteEventHelper( - mContext, mContext, !mIsReadOnly /* exitWhenDone */); + mActivity, mActivity, !mIsReadOnly /* exitWhenDone */); deleteHelper.delete(begin, end, mOriginalModel, which); } @@ -848,13 +848,13 @@ public class EditEventFragment extends Fragment implements EventHandler, OnColor // This will exit the edit event screen, should be called // when we want to return to the main calendar views if ((mCode & Utils.DONE_SAVE) != 0) { - if (mContext != null) { + if (mActivity != null) { long start = mModel.mStart; long end = mModel.mEnd; if (mModel.mAllDay) { // For allday events we want to go to the day in the // user's current tz - String tz = Utils.getTimeZone(mContext, null); + String tz = Utils.getTimeZone(mActivity, null); Time t = new Time(Time.TIMEZONE_UTC); t.set(start); t.timezone = tz; @@ -865,7 +865,7 @@ public class EditEventFragment extends Fragment implements EventHandler, OnColor t.timezone = tz; end = t.toMillis(true); } - CalendarController.getInstance(mContext).launchViewEvent(-1, start, end, + CalendarController.getInstance(mActivity).launchViewEvent(-1, start, end, Attendees.ATTENDEE_STATUS_NONE); } } @@ -877,7 +877,7 @@ public class EditEventFragment extends Fragment implements EventHandler, OnColor // Hide a software keyboard so that user won't see it even after this Fragment's // disappearing. - final View focusedView = mContext.getCurrentFocus(); + final View focusedView = mActivity.getCurrentFocus(); if (focusedView != null) { mInputMethodManager.hideSoftInputFromWindow(focusedView.getWindowToken(), 0); focusedView.clearFocus(); diff --git a/src/com/android/calendar/event/EditEventView.java b/src/com/android/calendar/event/EditEventView.java index 1dbc946e..a06774b8 100644 --- a/src/com/android/calendar/event/EditEventView.java +++ b/src/com/android/calendar/event/EditEventView.java @@ -498,7 +498,14 @@ public class EditEventView implements View.OnClickListener, DialogInterface.OnCa @Override public void onClick(View v) { - + if (!mView.hasWindowFocus()) { + // Don't do anything if the activity if paused. Since Activity doesn't + // have a built in way to do this, we would have to implement one ourselves and + // either cast our Activity to a specialized activity base class or implement some + // generic interface that tells us if an activity is paused. hasWindowFocus() is + // close enough if not quite perfect. + return; + } if (v == mStartDateButton) { mDateSelectedWasStartDate = true; } else { |