Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c9129804 authored by Sara Ting's avatar Sara Ting
Browse files

Prevent empty popup notification dialog resulting when events dismissed/snoozed.

Bug:6791254
Change-Id: Ibc209d2a56afda99b423b416cc7c0bb61a691520
parent 111745e9
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -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();
+12 −2
Original line number Diff line number Diff line
@@ -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();
    }
}