diff options
author | Sara Ting <sarating@google.com> | 2012-07-26 13:59:25 -0700 |
---|---|---|
committer | Sara Ting <sarating@google.com> | 2012-07-26 14:01:16 -0700 |
commit | c9129804f2ee152559f08eac83d953e9c88d4036 (patch) | |
tree | f1db69ab8d512f872d4867ba63e745467280c0ad /src/com/android/calendar/alerts | |
parent | 111745e9b06702ad3915a6af9d6a267c643234dc (diff) | |
download | android_packages_apps_Calendar-c9129804f2ee152559f08eac83d953e9c88d4036.tar.gz android_packages_apps_Calendar-c9129804f2ee152559f08eac83d953e9c88d4036.tar.bz2 android_packages_apps_Calendar-c9129804f2ee152559f08eac83d953e9c88d4036.zip |
Prevent empty popup notification dialog resulting when events dismissed/snoozed.
Bug:6791254
Change-Id: Ibc209d2a56afda99b423b416cc7c0bb61a691520
Diffstat (limited to 'src/com/android/calendar/alerts')
-rw-r--r-- | src/com/android/calendar/alerts/AlertActivity.java | 8 | ||||
-rw-r--r-- | src/com/android/calendar/alerts/AlertAdapter.java | 14 |
2 files changed, 18 insertions, 4 deletions
diff --git a/src/com/android/calendar/alerts/AlertActivity.java b/src/com/android/calendar/alerts/AlertActivity.java index b7a1f022..1e8c699c 100644 --- a/src/com/android/calendar/alerts/AlertActivity.java +++ b/src/com/android/calendar/alerts/AlertActivity.java @@ -143,8 +143,6 @@ public class AlertActivity extends Activity implements OnClickListener { } } - - private final OnItemClickListener mViewListener = new OnItemClickListener() { @Override @@ -215,6 +213,12 @@ public class AlertActivity extends Activity implements OnClickListener { } } + void closeActivityIfEmpty() { + if (mCursor != null && mCursor.getCount() == 0) { + AlertActivity.this.finish(); + } + } + @Override protected void onStop() { super.onStop(); diff --git a/src/com/android/calendar/alerts/AlertAdapter.java b/src/com/android/calendar/alerts/AlertAdapter.java index fc13088c..76522834 100644 --- a/src/com/android/calendar/alerts/AlertAdapter.java +++ b/src/com/android/calendar/alerts/AlertAdapter.java @@ -35,13 +35,15 @@ import java.util.TimeZone; public class AlertAdapter extends ResourceCursorAdapter { + private static AlertActivity alertActivity; private static boolean mFirstTime = true; private static int mTitleColor; private static int mOtherColor; // non-title fields private static int mPastEventColor; - public AlertAdapter(Context context, int resource) { - super(context, resource, null); + public AlertAdapter(AlertActivity activity, int resource) { + super(activity, resource, null); + this.alertActivity = activity; } @Override @@ -143,4 +145,12 @@ public class AlertAdapter extends ResourceCursorAdapter { whereView.setVisibility(View.VISIBLE); } } + + @Override + protected void onContentChanged () { + super.onContentChanged(); + + // Prevent empty popup notification. + alertActivity.closeActivityIfEmpty(); + } } |