attempt to work around bugs in Chinese ROMs
This commit is contained in:
parent
0381fe3c06
commit
f8fbb36a98
|
@ -0,0 +1,49 @@
|
|||
package eu.siacs.conversations.ui.widget;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
/**
|
||||
* A wrapper class to fix some weird fuck ups on Meizu devices
|
||||
* credit goes to the people in this thread https://github.com/android-in-china/Compatibility/issues/11
|
||||
*/
|
||||
public class TextInputEditText extends android.support.design.widget.TextInputEditText {
|
||||
|
||||
public TextInputEditText(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public TextInputEditText(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public TextInputEditText(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharSequence getHint() {
|
||||
String manufacturer = Build.MANUFACTURER.toUpperCase();
|
||||
if (!manufacturer.contains("MEIZU") || Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
return super.getHint();
|
||||
}else{
|
||||
try {
|
||||
return getSuperHintHack();
|
||||
}catch (Exception e){
|
||||
return super.getHint();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private CharSequence getSuperHintHack() throws NoSuchFieldException, IllegalAccessException {
|
||||
Field hintField = TextView.class.getDeclaredField("mHint");
|
||||
hintField.setAccessible(true);
|
||||
return (CharSequence) hintField.get(this);
|
||||
}
|
||||
}
|
||||
|
|
@ -38,7 +38,7 @@
|
|||
app:passwordToggleEnabled="true"
|
||||
app:passwordToggleTint="?android:textColorSecondary">
|
||||
|
||||
<android.support.design.widget.TextInputEditText
|
||||
<eu.siacs.conversations.ui.widget.TextInputEditText
|
||||
android:id="@+id/current_password"
|
||||
style="@style/Widget.Conversations.EditText"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -58,7 +58,7 @@
|
|||
app:passwordToggleEnabled="true"
|
||||
app:passwordToggleTint="?android:textColorSecondary">
|
||||
|
||||
<android.support.design.widget.TextInputEditText
|
||||
<eu.siacs.conversations.ui.widget.TextInputEditText
|
||||
android:id="@+id/new_password"
|
||||
style="@style/Widget.Conversations.EditText"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -82,7 +82,7 @@
|
|||
app:hintTextAppearance="@style/TextAppearance.Conversations.Design.Hint"
|
||||
app:errorTextAppearance="@style/TextAppearance.Conversations.Design.Error">
|
||||
|
||||
<android.support.design.widget.TextInputEditText
|
||||
<eu.siacs.conversations.ui.widget.TextInputEditText
|
||||
android:id="@+id/account_password"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
Loading…
Reference in New Issue