aboutsummaryrefslogtreecommitdiffstats
path: root/cgeo-calendar/src/cgeo/calendar/AbstractAddEntry.java
blob: e35ed190f017b4feec3486a70b6e8d2a57dd180c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package cgeo.calendar;

import org.eclipse.jdt.annotation.NonNull;

import android.util.Log;

abstract class AbstractAddEntry {

    @NonNull
    protected final CalendarEntry entry;
    @NonNull
    protected final CalendarActivity activity;

    public AbstractAddEntry(@NonNull final CalendarEntry entry, @NonNull final CalendarActivity activity) {
        this.entry = entry;
        this.activity = activity;
    }

    void addEntryToCalendar() {
        try {
            addEntryToCalendarInternal();
            activity.showToast(R.string.event_success);
        } catch (final Exception e) {
            activity.showToast(R.string.event_fail);

            Log.e(CalendarActivity.LOG_TAG, "addToCalendar", e);
        }
    }

    protected abstract void addEntryToCalendarInternal();

}