[android] Fix NPE in android.view.View.setPadding

Signed-off-by: Roman Tsisyk <roman@tsisyk.com>
This commit is contained in:
Roman Tsisyk 2021-05-07 10:08:39 +03:00
parent 0707b38357
commit a41d985489

View file

@ -22,17 +22,28 @@ abstract class BaseSettingsFragment extends BaseMwmFragment
private void savePaddings()
{
View parent = (View)mFrame.getParent();
mSavedPaddings.set(parent.getPaddingLeft(), parent.getPaddingTop(), parent.getPaddingRight(), parent.getPaddingBottom());
if (parent != null)
{
mSavedPaddings.set(parent.getPaddingLeft(), parent.getPaddingTop(), parent.getPaddingRight(), parent.getPaddingBottom());
}
}
protected void clearPaddings()
{
((View)mFrame.getParent()).setPadding(0, 0, 0, 0);
View parent = (View)mFrame.getParent();
if (parent != null)
{
parent.setPadding(0, 0, 0, 0);
}
}
protected void restorePaddings()
{
((View)mFrame.getParent()).setPadding(mSavedPaddings.left, mSavedPaddings.top, mSavedPaddings.right, mSavedPaddings.bottom);
View parent = (View)mFrame.getParent();
if (parent != null)
{
parent.setPadding(mSavedPaddings.left, mSavedPaddings.top, mSavedPaddings.right, mSavedPaddings.bottom);
}
}
@Nullable