[android] Minor deprecation fix

Signed-off-by: Alexander Borsuk <me@alex.bio>
This commit is contained in:
Alexander Borsuk 2021-05-16 00:16:46 +02:00 committed by Roman Tsisyk
parent fb49c39df0
commit 7b10fd725e

View file

@ -15,10 +15,10 @@ public abstract class BaseAsyncOperationFragment extends BaseMwmFragment
protected void showProgress()
{
int resId = getProgressMessageId();
String title = getString(resId);
ProgressDialogFragment dialog = ProgressDialogFragment.newInstance(title);
Objects.requireNonNull(getFragmentManager())
final int resId = getProgressMessageId();
final String title = getString(resId);
final ProgressDialogFragment dialog = ProgressDialogFragment.newInstance(title);
getParentFragmentManager()
.beginTransaction()
.add(dialog, PROGRESS_DIALOG_TAG)
.commitAllowingStateLoss();
@ -32,9 +32,8 @@ public abstract class BaseAsyncOperationFragment extends BaseMwmFragment
protected void hideProgress()
{
FragmentManager fm = getFragmentManager();
DialogFragment frag = (DialogFragment) Objects.requireNonNull(fm)
.findFragmentByTag(PROGRESS_DIALOG_TAG);
final FragmentManager fm = getParentFragmentManager();
final DialogFragment frag = (DialogFragment) fm.findFragmentByTag(PROGRESS_DIALOG_TAG);
if (frag != null)
frag.dismissAllowingStateLoss();
}