Bug 1462299 - input[date] unusable on Android 4.x; r=jchen

The issue stemmed from platform's DatePicker.
To make amends and fix both this bug and Bug 1460585 I went with
hiding the calendar and showing only the spinners for Api <21.

MozReview-Commit-ID: CS9pFdlMSTd

--HG--
extra : rebase_source : 64ed05fee21fdbabf7f8ba921cb56a6f40ed17c2
This commit is contained in:
Petru Lingurar 2018-07-10 11:26:01 +03:00
parent 5c830a87fd
commit f5a72bf632

View File

@ -9,6 +9,7 @@ import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.GregorianCalendar;
import org.mozilla.gecko.AppConstants;
import org.mozilla.gecko.util.GeckoBundle;
import org.mozilla.gecko.widget.AllCapsTextView;
import org.mozilla.gecko.widget.DateTimePicker;
@ -189,6 +190,16 @@ public abstract class PromptInput {
} catch (Exception e) {
Log.e(LOGTAG, "error parsing format string: " + e);
}
// The Material CalendarView is only available on Android >= API 21
// Prior to this, using DatePicker with CalendarUI would cause issues
// such as in Bug 1460585 and Bug 1462299
// Because of this, on Android versions earlier than API 21 we'll force use the SpinnerUI
if (AppConstants.Versions.preLollipop) {
input.setSpinnersShown(true);
input.setCalendarViewShown(false);
}
mView = (View)input;
} else if (mType.equals("week")) {
DateTimePicker input = new DateTimePicker(context, "yyyy-'W'ww", mValue,