Replace getFragmentManager() with getFM()

This commit is contained in:
wb9688 2020-08-03 14:47:02 +02:00
parent 13a065f2dc
commit 5fd7ae33b4
5 changed files with 13 additions and 20 deletions

View file

@ -148,10 +148,8 @@ public class MainFragment extends BaseFragment implements TabLayout.OnTabSelecte
switch (item.getItemId()) { switch (item.getItemId()) {
case R.id.action_search: case R.id.action_search:
try { try {
NavigationHelper.openSearchFragment( NavigationHelper.openSearchFragment(getFM(),
getFragmentManager(), ServiceHelper.getSelectedServiceId(activity), "");
ServiceHelper.getSelectedServiceId(activity),
"");
} catch (Exception e) { } catch (Exception e) {
ErrorActivity.reportUiError((AppCompatActivity) getActivity(), e); ErrorActivity.reportUiError((AppCompatActivity) getActivity(), e);
} }

View file

@ -505,7 +505,7 @@ public class VideoDetailFragment
case ReCaptchaActivity.RECAPTCHA_REQUEST: case ReCaptchaActivity.RECAPTCHA_REQUEST:
if (resultCode == Activity.RESULT_OK) { if (resultCode == Activity.RESULT_OK) {
NavigationHelper NavigationHelper
.openVideoDetailFragment(getFragmentManager(), serviceId, url, name); .openVideoDetailFragment(getFM(), serviceId, url, name);
} else { } else {
Log.e(TAG, "ReCaptcha failed"); Log.e(TAG, "ReCaptcha failed");
} }
@ -579,9 +579,9 @@ public class VideoDetailFragment
openPopupPlayer(false); openPopupPlayer(false);
break; break;
case R.id.detail_controls_playlist_append: case R.id.detail_controls_playlist_append:
if (getFragmentManager() != null && currentInfo != null) { if (getFM() != null && currentInfo != null) {
PlaylistAppendDialog.fromStreamInfo(currentInfo) PlaylistAppendDialog.fromStreamInfo(currentInfo)
.show(getFragmentManager(), TAG); .show(getFM(), TAG);
} }
break; break;
case R.id.detail_controls_download: case R.id.detail_controls_download:
@ -634,11 +634,8 @@ public class VideoDetailFragment
private void openChannel(final String subChannelUrl, final String subChannelName) { private void openChannel(final String subChannelUrl, final String subChannelName) {
try { try {
NavigationHelper.openChannelFragment( NavigationHelper.openChannelFragment(getFM(), currentInfo.getServiceId(),
getFragmentManager(), subChannelUrl, subChannelName);
currentInfo.getServiceId(),
subChannelUrl,
subChannelName);
} catch (Exception e) { } catch (Exception e) {
ErrorActivity.reportUiError((AppCompatActivity) getActivity(), e); ErrorActivity.reportUiError((AppCompatActivity) getActivity(), e);
} }

View file

@ -426,8 +426,8 @@ public class ChannelFragment extends BaseListInfoFragment<ChannelInfo>
case R.id.sub_channel_title_view: case R.id.sub_channel_title_view:
if (!TextUtils.isEmpty(currentInfo.getParentChannelUrl())) { if (!TextUtils.isEmpty(currentInfo.getParentChannelUrl())) {
try { try {
NavigationHelper.openChannelFragment(getFragmentManager(), NavigationHelper.openChannelFragment(getFM(), currentInfo.getServiceId(),
currentInfo.getServiceId(), currentInfo.getParentChannelUrl(), currentInfo.getParentChannelUrl(),
currentInfo.getParentChannelName()); currentInfo.getParentChannelName());
} catch (Exception e) { } catch (Exception e) {
ErrorActivity.reportUiError((AppCompatActivity) getActivity(), e); ErrorActivity.reportUiError((AppCompatActivity) getActivity(), e);

View file

@ -286,10 +286,8 @@ public class PlaylistFragment extends BaseListInfoFragment<PlaylistInfo> {
if (!TextUtils.isEmpty(result.getUploaderUrl())) { if (!TextUtils.isEmpty(result.getUploaderUrl())) {
headerUploaderLayout.setOnClickListener(v -> { headerUploaderLayout.setOnClickListener(v -> {
try { try {
NavigationHelper.openChannelFragment(getFragmentManager(), NavigationHelper.openChannelFragment(getFM(), result.getServiceId(),
result.getServiceId(), result.getUploaderUrl(), result.getUploaderName());
result.getUploaderUrl(),
result.getUploaderName());
} catch (Exception e) { } catch (Exception e) {
ErrorActivity.reportUiError((AppCompatActivity) getActivity(), e); ErrorActivity.reportUiError((AppCompatActivity) getActivity(), e);
} }

View file

@ -505,7 +505,7 @@ public class SearchFragment extends BaseListFragment<SearchInfo, ListExtractor.I
Log.d(TAG, "onClick() called with: v = [" + v + "]"); Log.d(TAG, "onClick() called with: v = [" + v + "]");
} }
if (TextUtils.isEmpty(searchEditText.getText())) { if (TextUtils.isEmpty(searchEditText.getText())) {
NavigationHelper.gotoMainFragment(getFragmentManager()); NavigationHelper.gotoMainFragment(getFM());
return; return;
} }
@ -807,7 +807,7 @@ public class SearchFragment extends BaseListFragment<SearchInfo, ListExtractor.I
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(intent -> { .subscribe(intent -> {
getFragmentManager().popBackStackImmediate(); getFM().popBackStackImmediate();
activity.startActivity(intent); activity.startActivity(intent);
}, throwable -> }, throwable ->
showError(getString(R.string.url_not_supported_toast), false))); showError(getString(R.string.url_not_supported_toast), false)));