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

Commit 6199bffe authored by Alan Viverette's avatar Alan Viverette Committed by Android (Google) Code Review
Browse files

Merge "Deprecate AnalogClock widget, Integer methods on TimePickerView"

parents 27616de4 646a0f8e
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -38139,7 +38139,7 @@ package android.widget {
    field protected android.database.Cursor mDataCursor;
  }
  public class AnalogClock extends android.view.View {
  public deprecated class AnalogClock extends android.view.View {
    ctor public AnalogClock(android.content.Context);
    ctor public AnalogClock(android.content.Context, android.util.AttributeSet);
    ctor public AnalogClock(android.content.Context, android.util.AttributeSet, int);
@@ -40200,12 +40200,16 @@ package android.widget {
    ctor public TimePicker(android.content.Context, android.util.AttributeSet);
    ctor public TimePicker(android.content.Context, android.util.AttributeSet, int);
    ctor public TimePicker(android.content.Context, android.util.AttributeSet, int, int);
    method public java.lang.Integer getCurrentHour();
    method public java.lang.Integer getCurrentMinute();
    method public deprecated java.lang.Integer getCurrentHour();
    method public deprecated java.lang.Integer getCurrentMinute();
    method public int getHour();
    method public int getMinute();
    method public boolean is24HourView();
    method public void setCurrentHour(java.lang.Integer);
    method public void setCurrentMinute(java.lang.Integer);
    method public deprecated void setCurrentHour(java.lang.Integer);
    method public deprecated void setCurrentMinute(java.lang.Integer);
    method public void setHour(int);
    method public void setIs24HourView(java.lang.Boolean);
    method public void setMinute(int);
    method public void setOnTimeChangedListener(android.widget.TimePicker.OnTimeChangedListener);
  }
+9 −5
Original line number Diff line number Diff line
@@ -40877,7 +40877,7 @@ package android.widget {
    field protected android.database.Cursor mDataCursor;
  }
  public class AnalogClock extends android.view.View {
  public deprecated class AnalogClock extends android.view.View {
    ctor public AnalogClock(android.content.Context);
    ctor public AnalogClock(android.content.Context, android.util.AttributeSet);
    ctor public AnalogClock(android.content.Context, android.util.AttributeSet, int);
@@ -42938,12 +42938,16 @@ package android.widget {
    ctor public TimePicker(android.content.Context, android.util.AttributeSet);
    ctor public TimePicker(android.content.Context, android.util.AttributeSet, int);
    ctor public TimePicker(android.content.Context, android.util.AttributeSet, int, int);
    method public java.lang.Integer getCurrentHour();
    method public java.lang.Integer getCurrentMinute();
    method public deprecated java.lang.Integer getCurrentHour();
    method public deprecated java.lang.Integer getCurrentMinute();
    method public int getHour();
    method public int getMinute();
    method public boolean is24HourView();
    method public void setCurrentHour(java.lang.Integer);
    method public void setCurrentMinute(java.lang.Integer);
    method public deprecated void setCurrentHour(java.lang.Integer);
    method public deprecated void setCurrentMinute(java.lang.Integer);
    method public void setHour(int);
    method public void setIs24HourView(java.lang.Boolean);
    method public void setMinute(int);
    method public void setOnTimeChangedListener(android.widget.TimePicker.OnTimeChangedListener);
  }
+2 −0
Original line number Diff line number Diff line
@@ -40,8 +40,10 @@ import java.util.TimeZone;
 * @attr ref android.R.styleable#AnalogClock_dial
 * @attr ref android.R.styleable#AnalogClock_hand_hour
 * @attr ref android.R.styleable#AnalogClock_hand_minute
 * @deprecated This widget is no longer supported.
 */
@RemoteView
@Deprecated
public class AnalogClock extends View {
    private Time mCalendar;

+83 −26
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.widget;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.Widget;
import android.content.Context;
@@ -29,18 +30,13 @@ import com.android.internal.R;
import java.util.Locale;

/**
 * A view for selecting the time of day, in either 24 hour or AM/PM mode. The
 * hour, each minute digit, and AM/PM (if applicable) can be conrolled by
 * vertical spinners. The hour can be entered by keyboard input. Entering in two
 * digit hours can be accomplished by hitting two digits within a timeout of
 * about a second (e.g. '1' then '2' to select 12). The minutes can be entered
 * by entering single digits. Under AM/PM mode, the user can hit 'a', 'A", 'p'
 * or 'P' to pick. For a dialog using this view, see
 * {@link android.app.TimePickerDialog}.
 * A widget for selecting the time of day, in either 24-hour or AM/PM mode.
 * <p>
 * See the <a href="{@docRoot}guide/topics/ui/controls/pickers.html">Pickers</a>
 * guide.
 * </p>
 * For a dialog using this view, see {@link android.app.TimePickerDialog}. See
 * the <a href="{@docRoot}guide/topics/ui/controls/pickers.html">Pickers</a>
 * guide for more information.
 *
 * @attr ref android.R.styleable#TimePicker_timePickerMode
 */
@Widget
public class TimePicker extends FrameLayout {
@@ -96,44 +92,105 @@ public class TimePicker extends FrameLayout {
    }

    /**
     * Set the current hour.
     * Sets the currently selected hour using 24-hour time.
     *
     * @param hour the hour to set, in the range (0-23)
     * @see #getHour()
     */
    public void setHour(int hour) {
        mDelegate.setCurrentHour(hour);
    }

    /**
     * Returns the currently selected hour using 24-hour time.
     *
     * @return the currently selected hour, in the range (0-23)
     * @see #setHour(int)
     */
    public int getHour() {
        return mDelegate.getCurrentHour();
    }

    /**
     * Sets the currently selected minute..
     *
     * @param minute the minute to set, in the range (0-59)
     * @see #getMinute()
     */
    public void setMinute(int minute) {
        mDelegate.setCurrentMinute(minute);
    }

    /**
     * Returns the currently selected minute.
     *
     * @return the currently selected minute, in the range (0-59)
     * @see #setMinute(int)
     */
    public int getMinute() {
        return mDelegate.getCurrentMinute();
    }

    /**
     * Sets the current hour.
     *
     * @deprecated Use {@link #setHour(int)}
     */
    public void setCurrentHour(Integer currentHour) {
        mDelegate.setCurrentHour(currentHour);
    @Deprecated
    public void setCurrentHour(@NonNull Integer currentHour) {
        setHour(currentHour);
    }

    /**
     * @return The current hour in the range (0-23).
     * @return the current hour in the range (0-23)
     * @deprecated Use {@link #getHour()}
     */
    @NonNull
    @Deprecated
    public Integer getCurrentHour() {
        return mDelegate.getCurrentHour();
    }

    /**
     * Set the current minute (0-59).
     *
     * @deprecated Use {@link #setMinute(int)}
     */
    public void setCurrentMinute(Integer currentMinute) {
    @Deprecated
    public void setCurrentMinute(@NonNull Integer currentMinute) {
        mDelegate.setCurrentMinute(currentMinute);
    }

    /**
     * @return The current minute.
     * @return the current minute
     * @deprecated Use {@link #getMinute()}
     */
    @NonNull
    @Deprecated
    public Integer getCurrentMinute() {
        return mDelegate.getCurrentMinute();
    }

    /**
     * Set whether in 24 hour or AM/PM mode.
     * Sets whether this widget displays time in 24-hour mode or 12-hour mode
     * with an AM/PM picker.
     *
     * @param is24HourView True = 24 hour mode. False = AM/PM.
     * @param is24HourView {@code true} to display in 24-hour mode,
     *                     {@code false} for 12-hour mode with AM/PM
     * @see #is24HourView()
     */
    public void setIs24HourView(Boolean is24HourView) {
    public void setIs24HourView(@NonNull Boolean is24HourView) {
        if (is24HourView == null) {
            return;
        }

        mDelegate.setIs24HourView(is24HourView);
    }

    /**
     * @return true if this is in 24 hour view else false.
     * @return {@code true} if this widget displays time in 24-hour mode,
     *         {@code false} otherwise}
     * @see #setIs24HourView(Boolean)
     */
    public boolean is24HourView() {
        return mDelegate.is24HourView();
@@ -210,13 +267,13 @@ public class TimePicker extends FrameLayout {
     * for the real behavior.
     */
    interface TimePickerDelegate {
        void setCurrentHour(Integer currentHour);
        Integer getCurrentHour();
        void setCurrentHour(int currentHour);
        int getCurrentHour();

        void setCurrentMinute(Integer currentMinute);
        Integer getCurrentMinute();
        void setCurrentMinute(int currentMinute);
        int getCurrentMinute();

        void setIs24HourView(Boolean is24HourView);
        void setIs24HourView(boolean is24HourView);
        boolean is24HourView();

        void setOnTimeChangedListener(OnTimeChangedListener onTimeChangedListener);
+5 −5
Original line number Diff line number Diff line
@@ -376,7 +376,7 @@ class TimePickerClockDelegate extends TimePicker.AbstractTimePickerDelegate impl
     * Set the current hour.
     */
    @Override
    public void setCurrentHour(Integer currentHour) {
    public void setCurrentHour(int currentHour) {
        if (mInitialHourOfDay == currentHour) {
            return;
        }
@@ -393,7 +393,7 @@ class TimePickerClockDelegate extends TimePicker.AbstractTimePickerDelegate impl
     * @return The current hour in the range (0-23).
     */
    @Override
    public Integer getCurrentHour() {
    public int getCurrentHour() {
        int currentHour = mRadialTimePickerView.getCurrentHour();
        if (mIs24HourView) {
            return currentHour;
@@ -412,7 +412,7 @@ class TimePickerClockDelegate extends TimePicker.AbstractTimePickerDelegate impl
     * Set the current minute (0-59).
     */
    @Override
    public void setCurrentMinute(Integer currentMinute) {
    public void setCurrentMinute(int currentMinute) {
        if (mInitialMinute == currentMinute) {
            return;
        }
@@ -427,7 +427,7 @@ class TimePickerClockDelegate extends TimePicker.AbstractTimePickerDelegate impl
     * @return The current minute.
     */
    @Override
    public Integer getCurrentMinute() {
    public int getCurrentMinute() {
        return mRadialTimePickerView.getCurrentMinute();
    }

@@ -437,7 +437,7 @@ class TimePickerClockDelegate extends TimePicker.AbstractTimePickerDelegate impl
     * @param is24HourView True = 24 hour mode. False = AM/PM.
     */
    @Override
    public void setIs24HourView(Boolean is24HourView) {
    public void setIs24HourView(boolean is24HourView) {
        if (is24HourView == mIs24HourView) {
            return;
        }
Loading