- List of Android version names
- Содержание
- Cupcake
- Donut
- Eclair
- Froyo
- Gingerbread
- Honeycomb
- Ice Cream Sandwich
- Jelly Bean
- KitKat
- Lollipop
- Marshmallow
- Nougat
- Android 10
- List of Android version names
- Содержание
- Cupcake
- Donut
- Eclair
- Froyo
- Gingerbread
- Honeycomb
- Ice Cream Sandwich
- Jelly Bean
- KitKat
- Lollipop
- Marshmallow
- Nougat
- Android 10
- Поле ввода числовых значений в Android
- Начнем с требований
- Анализ
- Реализация
- Отладка
- Бонус
List of Android version names
Android versions up to Android 10! 10 got, additionally to their nummeric version number, a code-name, which was assigned by Google. Like the naming of Ubuntu versions (names of animals with an adjective [1] ), Android version names were names of, mostly american, sweets, where the first letter was in alphabetical order.
The assignment of numeric and textual version names are not always consistent. Android 4.0 and Android 4.1, for example, have different version names, but Android 5.0, 5.1 and 5.1.1 share the same version name.
Starting with Android 10! 10, Android versions do not get a codename anymore. Since then, the Android versions will be released with their version number only. [2] [3] [4] [5]
Содержание
Cupcake
The Android version 1500! 1.5 Cupcake is the first version, which got a name assigned, which is Cupcake. Cupcakes are muffin-like cakes, which mostly has a creamy hood.
Donut
Version 1600! 1.6 Donut was given the name Donut.
Eclair
Android-Version 2000! 2 Eclair and 2100! 2.1 Eclair share the same name, Eclair. Eclairs are longly biscuits overdrawn with chocolate.
Froyo
Frozen Yogurt is a ice-like dessert made with milk and yogurt and is also the name of the Android version 2200! 2.2 Froyo.
Gingerbread
The name of Android version 2300! 2.3 «Gingerbread» is Gingerbread, which are cake-like biscuits mostly eaten around christmas time.
Honeycomb
The android version mostly made for tablets, Android 3000! 3.0 Honeycomb, is called Honeycomb. The bootanimation of this android version is also made like a honeycomb.
Ice Cream Sandwich
Android 4.0 is called after a sweet, which is made of delicious ice cream bewtween two biscuits: an Ice Cream Sandwhich.
Jelly Bean
Jelly beans are colorful, mostly made out of sugar, sweets, which have a hard shell and are filled with jelly. The following android versions share this name:
KitKat
KitKat is a brand from Nestle, and is a chocolate bar filled with waffles. Android 4.4 is named after this sweet: 4.4! 4.4 «KitKat».
Lollipop
Lollipops are sweets in different flavors on a stalk and is also the name of the following android versions:
Marshmallow
The android version 6.0, announced at 17th of august in 2015 is called after the sweet Marshmallow.
Nougat
Android 7, also called Android N, officialy got the name Nougat.
Android 8, also called Android O, carries the name Oreo, which are two crispy chocolate cookies with a vanilla cream center.
Android 9, also called Android Pie, carries the name Pie, which is the name of different sweet dishes.
The version 9! 9 was the last Android version which got a codename assigned.
Android 10
Google announced that a new Android Version will be officially known as Android 10.
Источник
List of Android version names
Android versions up to Android 10! 10 got, additionally to their nummeric version number, a code-name, which was assigned by Google. Like the naming of Ubuntu versions (names of animals with an adjective [1] ), Android version names were names of, mostly american, sweets, where the first letter was in alphabetical order.
The assignment of numeric and textual version names are not always consistent. Android 4.0 and Android 4.1, for example, have different version names, but Android 5.0, 5.1 and 5.1.1 share the same version name.
Starting with Android 10! 10, Android versions do not get a codename anymore. Since then, the Android versions will be released with their version number only. [2] [3] [4] [5]
Содержание
Cupcake
The Android version 1500! 1.5 Cupcake is the first version, which got a name assigned, which is Cupcake. Cupcakes are muffin-like cakes, which mostly has a creamy hood.
Donut
Version 1600! 1.6 Donut was given the name Donut.
Eclair
Android-Version 2000! 2 Eclair and 2100! 2.1 Eclair share the same name, Eclair. Eclairs are longly biscuits overdrawn with chocolate.
Froyo
Frozen Yogurt is a ice-like dessert made with milk and yogurt and is also the name of the Android version 2200! 2.2 Froyo.
Gingerbread
The name of Android version 2300! 2.3 «Gingerbread» is Gingerbread, which are cake-like biscuits mostly eaten around christmas time.
Honeycomb
The android version mostly made for tablets, Android 3000! 3.0 Honeycomb, is called Honeycomb. The bootanimation of this android version is also made like a honeycomb.
Ice Cream Sandwich
Android 4.0 is called after a sweet, which is made of delicious ice cream bewtween two biscuits: an Ice Cream Sandwhich.
Jelly Bean
Jelly beans are colorful, mostly made out of sugar, sweets, which have a hard shell and are filled with jelly. The following android versions share this name:
KitKat
KitKat is a brand from Nestle, and is a chocolate bar filled with waffles. Android 4.4 is named after this sweet: 4.4! 4.4 «KitKat».
Lollipop
Lollipops are sweets in different flavors on a stalk and is also the name of the following android versions:
Marshmallow
The android version 6.0, announced at 17th of august in 2015 is called after the sweet Marshmallow.
Nougat
Android 7, also called Android N, officialy got the name Nougat.
Android 8, also called Android O, carries the name Oreo, which are two crispy chocolate cookies with a vanilla cream center.
Android 9, also called Android Pie, carries the name Pie, which is the name of different sweet dishes.
The version 9! 9 was the last Android version which got a codename assigned.
Android 10
Google announced that a new Android Version will be officially known as Android 10.
Источник
Поле ввода числовых значений в Android
Начнем с требований
Анализ
Из всего спектра элементов управления в Android нас интересует виджет EditText .
Обратимся к документации и посмотрим, что нам предлагает Android SDK.
EditText наследуется от TextView , который, в свою очередь, обладает свойствами:
XML-разметка
digits – позволяет установить набор специальных символов, которые может принимать поле и автоматически включает режим ввода чисел.
numeric – задает обработчик ввода чисел.
inputType – с помощью набора константных значений позволяет сгенерировать требуемый обработчик ввода.
Публичные методы класса
setFilters – позволяет задать набор фильтров, которые будут применяться при вводе значений в поле.
digits , numeric и inputType позволяют ограничить набор вводимых символов, но никак не влияют на точность числа, а вот setFilters , как раз то, что нам нужно.
Реализация
Перед созданием собственного фильтра, сделаем так, чтобы в поле можно было вводить только числа и десятичный разделитель.
Теперь зададим собственный фильтр для поля ввода, чтобы принимать только значения соответствующие заданной точности.
Нам потребуется реализовать интерфейс InputFilter , а конкретно переопределить метод filter .
Согласно документации, этот метод вызывается при замене значения в поле ввода (dest) в диапазоне от dstart до dend на текст из буфера (source) в диапазоне от start до end.
Метод возвращает объект класса CharSequence , который будет установлен в поле ввода взамен текущему значению. Если заменять значение поля ввода не требуется, то в методе следует вернуть null .
В конструктор нашего фильтра будем передавать количество символов до и после десятичного разделителя.
Переопределяем метод filter . Алгоритм проверки вводимых значений следующий:
- До помещения буферного значения в поле ввода мы будем вставлять это значение в некоторую переменную.
- Если полученное значение удовлетворяет нашим требованиям точности, то мы разрешаем ввод, вернув null .
- В противном случае возвращаем пустую строку, тем самым отказываясь от вводимого значения.
Формируем будущее значение после ввода пользователя:
Для удобства манипуляция со строкой, создадим экземпляр класса StringBuilder на основе исходного значения поля ввода и произведем необходимые замены с учетом вводимого значения.
В результате в переменной newText будет содержаться будущее значения текстового поля.
Теперь нам следует проверить корректность нового значения.
Оно должно удовлетворять следующим условиям:
- Количество десятичных разделителей не должно превышать 1.
123, 123.45 — верно, 12.3.4 — неверно. - Количество символов целой и дробной частей числа должно удовлетворять заданной точности.
Проверим количество разделителей, для этого мы переберем все символы результирующей строки.
Если найдется десятичный разделитель, то запомним его индекс. В случае повторного нахождения разделителя, ввод считается некорректным и цикл останавливается.
В завершении возвращаем результат.
Если ввод корректный, то возвращаем null , тем самым принимая вводимые значения,
в противном случае возвращаем пустую строку, чтобы не передавать в поле ввода значения.
Отладка
Видим, что приложение корректно обрабатывает целую и дробную части числа, запрещает вводить несколько десятичных разделителей.
Однако наблюдается интересная ситуация, если удалить десятичный разделитель, то мы выходим за границы точности.
Об этом упоминается в документации
Be careful to not to reject 0-length replacements, as this is what happens when you delete text.
Нужно быть осторожным с заменами нулевой длины, как это происходит при удалении текста.
Что же произошло на самом деле?
Наш алгоритм отработал корректно и в условии проверки длины целой части числа выявил, что допустимая точность нарушена и вернул пустую строку. Но само действие удаления символов было применено к исходному значению поля ввода.
Решим эту проблему следующим образом — выявим факт удаления символов. Документация подсказывает, что в этом случае происходит замена с нулевой длиной. Выделим из исходного значения поля ввода удаляемые символы и вернем их в качестве результата нашего метода, тем самым откажемся от удаления.
Нам потребуется изменить блок кода, где возвращается результат
Таким образом контрольный пример выполнен, заданная точность достигнута.
Библиотека успешно используется в продакшене.
Подключить её можно с помощью Gradle
Бонус
Часто бывает необходимым запретить отображение системной клавиатуры для поля ввода.
Например, если используется клавиатура из приложения.
На помощь приходит метод класса EditText, появившийся в Android версии 21 и выше:
setShowSoftInputOnFocus(boolean show)
Вообще-то, этот метод был и в ранних версиях, но был приватным.
public void showSoftInputOnFocusCompat(boolean isShow) <
<>
Источник