// Path: app/src/main/java/de/arnowelzel/android/periodical/PeriodicalDatabase.java
// final static int PERIOD_CONFIRMED = 2;
// 
// Path: app/src/main/java/de/arnowelzel/android/periodical/PeriodicalDatabase.java
// final static int PERIOD_START = 1;


import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.app.backup.BackupManager;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import androidx.annotation.NonNull;
import com.google.android.material.navigation.NavigationView;
import com.yariksoffice.lingver.Lingver;
import androidx.core.view.GravityCompat;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.appcompat.app.ActionBarDrawerToggle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import android.view.GestureDetector;
import android.view.GestureDetector.SimpleOnGestureListener;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.webkit.WebView;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.ViewFlipper;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.GregorianCalendar;
import static de.arnowelzel.android.periodical.PeriodicalDatabase.DayEntry.PERIOD_CONFIRMED;
import static de.arnowelzel.android.periodical.PeriodicalDatabase.DayEntry.PERIOD_START;
        int idButton = v.getId();
        int nButtonClicked = 0;

        int calButtonIds[];
        if (viewCurrent == R.id.calendar) {
            calButtonIds = this.calButtonIds;
        } else {
            calButtonIds = calButtonIds_2;
        }

        while (nButtonClicked < 42) {
            if (calButtonIds[nButtonClicked] == idButton)
                break;
            nButtonClicked++;
        }
        final int day = nButtonClicked - firstDayOfWeek + 2;

        // If "direct details" is set by the user, just open the details
        PreferenceUtils preferences = new PreferenceUtils(context);

        if (preferences.getBoolean("direct_details", false)) {
            showDetailsActivity(yearCurrent, monthCurrent, day);
        } else {
            // Set or remove entry with confirmation
            final AlertDialog.Builder builder = new AlertDialog.Builder(this);
            builder.setTitle(getResources()
                    .getString(R.string.calendaraction_title));

            final GregorianCalendar date = new GregorianCalendar(yearCurrent, monthCurrent - 1, day);
            int type = dbMain.getEntryType(date);
// Path: app/src/main/java/de/arnowelzel/android/periodical/PeriodicalDatabase.java
// final static int PERIOD_CONFIRMED = 2;
// 
// Path: app/src/main/java/de/arnowelzel/android/periodical/PeriodicalDatabase.java
// final static int PERIOD_START = 1;


// Path: app/src/main/java/de/arnowelzel/android/periodical/MainActivityApp.java
import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.app.backup.BackupManager;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import androidx.annotation.NonNull;
import com.google.android.material.navigation.NavigationView;
import com.yariksoffice.lingver.Lingver;
import androidx.core.view.GravityCompat;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.appcompat.app.ActionBarDrawerToggle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import android.view.GestureDetector;
import android.view.GestureDetector.SimpleOnGestureListener;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.webkit.WebView;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.ViewFlipper;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.GregorianCalendar;
import static de.arnowelzel.android.periodical.PeriodicalDatabase.DayEntry.PERIOD_CONFIRMED;
import static de.arnowelzel.android.periodical.PeriodicalDatabase.DayEntry.PERIOD_START;

        int idButton = v.getId();
        int nButtonClicked = 0;

        int calButtonIds[];
        if (viewCurrent == R.id.calendar) {
            calButtonIds = this.calButtonIds;
        } else {
            calButtonIds = calButtonIds_2;
        }

        while (nButtonClicked < 42) {
            if (calButtonIds[nButtonClicked] == idButton)
                break;
            nButtonClicked++;
        }
        final int day = nButtonClicked - firstDayOfWeek + 2;

        // If "direct details" is set by the user, just open the details
        PreferenceUtils preferences = new PreferenceUtils(context);

        if (preferences.getBoolean("direct_details", false)) {
            showDetailsActivity(yearCurrent, monthCurrent, day);
        } else {
            // Set or remove entry with confirmation
            final AlertDialog.Builder builder = new AlertDialog.Builder(this);
            builder.setTitle(getResources()
                    .getString(R.string.calendaraction_title));

            final GregorianCalendar date = new GregorianCalendar(yearCurrent, monthCurrent - 1, day);
            int type = dbMain.getEntryType(date);
            if (type != PERIOD_START && type != PERIOD_CONFIRMED) {