mirror of
https://github.com/strongswan/strongswan.git
synced 2025-10-04 00:00:14 -04:00
android: Avoid using deprecated ViewCompat methods
This commit is contained in:
parent
01c81ca15f
commit
880e273985
@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
package org.strongswan.android.ui.widget;
|
package org.strongswan.android.ui.widget;
|
||||||
|
|
||||||
|
import android.animation.Animator;
|
||||||
|
import android.animation.AnimatorListenerAdapter;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.TypedArray;
|
import android.content.res.TypedArray;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
@ -33,8 +35,6 @@ import com.google.android.material.textfield.TextInputLayout;
|
|||||||
import org.strongswan.android.R;
|
import org.strongswan.android.R;
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.core.view.ViewCompat;
|
|
||||||
import androidx.core.view.ViewPropertyAnimatorListenerAdapter;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Layout that extends {@link TextInputLayout} with a helper text
|
* Layout that extends {@link TextInputLayout} with a helper text
|
||||||
@ -113,8 +113,8 @@ public class TextInputLayoutHelper extends TextInputLayout
|
|||||||
showHelper(hasFocus);
|
showHelper(hasFocus);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
ViewCompat.setPaddingRelative(mHelperContainer, ViewCompat.getPaddingStart(text),
|
mHelperContainer.setPaddingRelative(text.getPaddingStart(), 0,
|
||||||
0, ViewCompat.getPaddingEnd(text), text.getPaddingBottom());
|
text.getPaddingEnd(), text.getPaddingBottom());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -158,27 +158,27 @@ public class TextInputLayoutHelper extends TextInputLayout
|
|||||||
}
|
}
|
||||||
if (show)
|
if (show)
|
||||||
{
|
{
|
||||||
ViewCompat.animate(mHelperContainer)
|
mHelperContainer.animate()
|
||||||
.alpha(1f)
|
.alpha(1f)
|
||||||
.setDuration(200)
|
.setDuration(200)
|
||||||
.setListener(new ViewPropertyAnimatorListenerAdapter() {
|
.setListener(new AnimatorListenerAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void onAnimationStart(View view)
|
public void onAnimationStart(Animator animation)
|
||||||
{
|
{
|
||||||
view.setVisibility(View.VISIBLE);
|
mHelperContainer.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
}).start();
|
}).start();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ViewCompat.animate(mHelperContainer)
|
mHelperContainer.animate()
|
||||||
.alpha(0f)
|
.alpha(0f)
|
||||||
.setDuration(200)
|
.setDuration(200)
|
||||||
.setListener(new ViewPropertyAnimatorListenerAdapter() {
|
.setListener(new AnimatorListenerAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void onAnimationEnd(View view)
|
public void onAnimationEnd(Animator animation)
|
||||||
{
|
{
|
||||||
view.setVisibility(View.INVISIBLE);
|
mHelperContainer.setVisibility(View.INVISIBLE);
|
||||||
}
|
}
|
||||||
}).start();
|
}).start();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user