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

Commit 068bb327 authored by Wenyi Wang's avatar Wenyi Wang
Browse files

Pass null resource ID (0) to AlertDialog constructor

- Including some cleanup

Bug: 38393777

Test: manually verified date picker dialog style is correct

Change-Id: I1f843fbe4d9ea8e29a5ce72303720e2c50371ad6
parent e1be5ce0
Loading
Loading
Loading
Loading
+1 −41
Original line number Diff line number Diff line
@@ -75,21 +75,6 @@ public class DatePickerDialog extends AlertDialog implements OnClickListener,
        void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth);
    }

    /**
     * @param context The context the dialog is to run in.
     * @param callBack How the parent is notified that the date is set.
     * @param year The initial year of the dialog
     * @param monthOfYear The initial month of the dialog.
     * @param dayOfMonth The initial day of the dialog.
     */
    public DatePickerDialog(Context context,
            OnDateSetListener callBack,
            int year,
            int monthOfYear,
            int dayOfMonth) {
        this(context, callBack, year, monthOfYear, dayOfMonth, false);
    }

    /**
     * @param context The context the dialog is to run in.
     * @param callBack How the parent is notified that the date is set.
@@ -106,28 +91,10 @@ public class DatePickerDialog extends AlertDialog implements OnClickListener,
            int dayOfMonth,
            boolean yearOptional) {
        // Don't pass a theme id. Instead use the default alert dialog theme.
        this(context, /* themeId = */ -1, callBack, year, monthOfYear, dayOfMonth,
        this(context, /* themeId = */ 0, callBack, year, monthOfYear, dayOfMonth,
                yearOptional);
    }

    /**
     * @param context The context the dialog is to run in.
     * @param theme the theme to apply to this dialog
     * @param callBack How the parent is notified that the date is set.
     * @param year The initial year of the dialog or {@link DatePickerDialog#NO_YEAR} if no year
     *  has been specified
     * @param monthOfYear The initial month of the dialog.
     * @param dayOfMonth The initial day of the dialog.
     */
    public DatePickerDialog(Context context,
            int theme,
            OnDateSetListener callBack,
            int year,
            int monthOfYear,
            int dayOfMonth) {
        this(context, theme, callBack, year, monthOfYear, dayOfMonth, false);
    }

    /**
     * @param context The context the dialog is to run in.
     * @param theme the theme to apply to this dialog
@@ -183,13 +150,6 @@ public class DatePickerDialog extends AlertDialog implements OnClickListener,
        updateTitle(year, month, day);
    }

    public void updateDate(int year, int monthOfYear, int dayOfMonth) {
        mInitialYear = year;
        mInitialMonth = monthOfYear;
        mInitialDay = dayOfMonth;
        mDatePicker.updateDate(year, monthOfYear, dayOfMonth);
    }

    private void updateTitle(int year, int month, int day) {
        final Calendar calendar = Calendar.getInstance();
        calendar.set(Calendar.YEAR, year);