/
githubmirror
/
omim
Обзор
Документация
Войти
/
githubmirror
/
omim
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
android/src/com/mapswithme/maps/widget/CustomTextInputLayout.java
49 строк
1 KB
Александр Зацепин
[android] Migrated code to Android X
22 окт 2019, 15:11
22 окт 2019, 15:11
f2dd324
Код
Авторство
О чём код?
package com.mapswithme.maps.widget; import android.content.Context; import android.graphics.Canvas; import androidx.annotation.Nullable; import com.google.android.material.textfield.TextInputLayout; import androidx.core.view.ViewCompat; import android.text.TextUtils; import android.util.AttributeSet; /** * Fixes bug mentioned here https://code.google.com/p/android/issues/detail?id=175228 */ public class CustomTextInputLayout extends TextInputLayout { private boolean mHintChanged = true; public CustomTextInputLayout(Context context) { super(context); } public CustomTextInputLayout(Context context, AttributeSet attrs) { super(context, attrs); } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); if (mHintChanged && ViewCompat.isLaidOut(this)) { // In case that hint is changed programmatically CharSequence currentEditTextHint = getEditText().getHint(); if (!TextUtils.isEmpty(currentEditTextHint)) setHint(currentEditTextHint); mHintChanged = false; } } @Override public void setHint(@Nullable CharSequence hint) { super.setHint(hint); mHintChanged = true; } }