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

Unverified Commit 66e68f83 authored by Aayush Gupta's avatar Aayush Gupta Committed by Michael Bestas
Browse files

CalendarEventModel: Mark getCalendarEventColors method as nullable



Change-Id: Ia38b1deddc198ddf51a8a2b88fcc8c76fd3264f0
Signed-off-by: default avatarAayush Gupta <aayushgupta219@gmail.com>
parent 530e17a9
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -26,6 +26,8 @@ import android.provider.CalendarContract.Reminders;
import android.text.TextUtils;
import android.text.util.Rfc822Token;

import androidx.annotation.Nullable;

import com.android.calendar.event.EditEventHelper;
import com.android.calendar.event.EventColorCache;
import com.android.calendar.settings.GeneralPreferences;
@@ -770,6 +772,7 @@ public class CalendarEventModel implements Serializable {
        mEventColorInitialized = true;
    }

    @Nullable
    public int[] getCalendarEventColors() {
        if (mEventColorCache != null) {
            return mEventColorCache.getColorArray(mCalendarAccountName, mCalendarAccountType);
+8 −4
Original line number Diff line number Diff line
@@ -1485,10 +1485,14 @@ public class EditEventView implements View.OnClickListener, DialogInterface.OnCa
        mModel.mCalendarAccountName = c.getString(EditEventHelper.CALENDARS_INDEX_ACCOUNT_NAME);
        mModel.mCalendarAccountType = c.getString(EditEventHelper.CALENDARS_INDEX_ACCOUNT_TYPE);
        // TODO: try to find a similar color within the new event colors before falling back to the calendar color
        if (mModel.getCalendarEventColors() != null) {
            mModel.setEventColor(Arrays.stream(mModel.getCalendarEventColors())
                    .filter(color -> color == mModel.getEventColor())
                    .findFirst()
                    .orElse(mModel.getCalendarColor()));
        } else {
            mModel.setEventColor(mModel.getCalendarColor());
        }
        setSpinnerBackgroundColor(mModel.getEventColor());
        setColorPickerButtonStates(mModel.getCalendarEventColors());