Projects >> platform_frameworks_base >>f114809031c5e5017bf69ab7a6d01024f1745fc8

Chunk
Conflicting content
import java.util.Arrays;
import java.util.Calendar;
import java.util.Locale;
<<<<<<< HEAD
import java.util.TimeZone;
=======
>>>>>>> 66edf2bb3ffc6e03d942cdc94f1ca2daf5e64167

/**
 * This class is a widget for selecting a date. The date can be selected by a
Solution content
import java.util.Arrays;
import java.util.Calendar;
import java.util.Locale;
import java.util.TimeZone;

/**
 * This class is a widget for selecting a date. The date can be selected by a
File
DatePicker.java
Developer's decision
Version 1
Kind of conflict
Import
Chunk
Conflicting content
    private static final int DEFAULT_START_YEAR = 1900;

    private static final int DEFAULT_END_YEAR = 2100;
<<<<<<< HEAD
=======

    // This ignores Undecimber, but we only support real Gregorian calendars.
    private static final int NUMBER_OF_MONTHS = 12;

    /* UI Components */
    private final NumberPicker mDayPicker;
    private final NumberPicker mMonthPicker;
    private final NumberPicker mYearPicker;
>>>>>>> 66edf2bb3ffc6e03d942cdc94f1ca2daf5e64167

    private static final boolean DEFAULT_CALENDAR_VIEW_SHOWN = true;
Solution content
    private static final int DEFAULT_START_YEAR = 1900;

    private static final int DEFAULT_END_YEAR = 2100;

    private static final boolean DEFAULT_CALENDAR_VIEW_SHOWN = true;
File
DatePicker.java
Developer's decision
Version 1
Kind of conflict
Attribute
Comment
Chunk
Conflicting content
                updateCalendarView();
                notifyDateChanged();
            }
<<<<<<< HEAD
        };

        mSpinners = (LinearLayout) findViewById(R.id.pickers);
=======
        });
        mMonthPicker = (NumberPicker) findViewById(R.id.month);
        mMonthPicker.setFormatter(NumberPicker.TWO_DIGIT_FORMATTER);
        final String[] months = getShortMonths();

        /*
         * If the user is in a locale where the month names are numeric,
         * use just the number instead of the "month" character for
         * consistency with the other fields.
         */
        if (months[0].startsWith("1")) {
            for (int i = 0; i < months.length; i++) {
                months[i] = String.valueOf(i + 1);
            }
            mMonthPicker.setRange(1, NUMBER_OF_MONTHS);
        } else {
            mMonthPicker.setRange(1, NUMBER_OF_MONTHS, months);
        }
>>>>>>> 66edf2bb3ffc6e03d942cdc94f1ca2daf5e64167

        // calendar view day-picker
        mCalendarView = (CalendarView) findViewById(R.id.calendar_view);
Solution content
                updateCalendarView();
                notifyDateChanged();
            }
        };

        mSpinners = (LinearLayout) findViewById(R.id.pickers);

        // calendar view day-picker
        mCalendarView = (CalendarView) findViewById(R.id.calendar_view);
File
DatePicker.java
Developer's decision
Version 1
Kind of conflict
Attribute
Cast expression
Comment
If statement
Method invocation
Variable
Chunk
Conflicting content
            parent.addView(mDaySpinner);
        }
        if (!didYear) {
<<<<<<< HEAD
            parent.addView(mYearSpinner);
        }
    }

    /**
     * Updates the current date.
     *
     * @param year The year.
     * @param month The month which is starting from zero.
     * @param dayOfMonth The day of the month.
     */
    public void updateDate(int year, int month, int dayOfMonth) {
        if (!isNewDate(year, month, dayOfMonth)) {
            return;
=======
            parent.addView(mYearPicker);
        }
    }

    public void updateDate(int year, int monthOfYear, int dayOfMonth) {
        if (mYear != year || mMonth != monthOfYear || mDay != dayOfMonth) {
            mYear = year;
            mMonth = monthOfYear;
            mDay = dayOfMonth;
            updateSpinners();
            reorderPickers(getShortMonths());
            notifyDateChanged();
        }
    }

    private String[] getShortMonths() {
        final Locale currentLocale = Locale.getDefault();
        if (currentLocale.equals(mMonthLocale) && mShortMonths != null) {
            return mShortMonths;
        } else {
            synchronized (mMonthUpdateLock) {
                if (!currentLocale.equals(mMonthLocale)) {
                    mShortMonths = new String[NUMBER_OF_MONTHS];
                    for (int i = 0; i < NUMBER_OF_MONTHS; i++) {
                        mShortMonths[i] = DateUtils.getMonthString(Calendar.JANUARY + i,
                                DateUtils.LENGTH_MEDIUM);
                    }
                    mMonthLocale = currentLocale;
                }
            }
            return mShortMonths;
        }
    }

    private static class SavedState extends BaseSavedState {

        private final int mYear;
        private final int mMonth;
        private final int mDay;

        /**
         * Constructor called from {@link DatePicker#onSaveInstanceState()}
         */
        private SavedState(Parcelable superState, int year, int month, int day) {
            super(superState);
            mYear = year;
            mMonth = month;
            mDay = day;
        }
        
        /**
         * Constructor called from {@link #CREATOR}
         */
        private SavedState(Parcel in) {
            super(in);
            mYear = in.readInt();
            mMonth = in.readInt();
            mDay = in.readInt();
        }

        public int getYear() {
            return mYear;
        }

        public int getMonth() {
            return mMonth;
        }

        public int getDay() {
            return mDay;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            super.writeToParcel(dest, flags);
            dest.writeInt(mYear);
            dest.writeInt(mMonth);
            dest.writeInt(mDay);
>>>>>>> 66edf2bb3ffc6e03d942cdc94f1ca2daf5e64167
        }
        setDate(year, month, dayOfMonth);
        updateSpinners();
Solution content
     *
            parent.addView(mDaySpinner);
        }
        if (!didYear) {
            parent.addView(mYearSpinner);
        }
    }

    /**
     * Updates the current date.
     * @param year The year.
     * @param month The month which is starting from zero.
     * @param dayOfMonth The day of the month.
     */
    public void updateDate(int year, int month, int dayOfMonth) {
        if (!isNewDate(year, month, dayOfMonth)) {
            return;
        }
        setDate(year, month, dayOfMonth);
        updateSpinners();
File
DatePicker.java
Developer's decision
Version 1
Kind of conflict
Annotation
Attribute
Class signature
Comment
If statement
Method declaration
Method invocation
Method signature
Return statement