Merge pull request #3892 from wb9688/fix-local-playlist-tab

Fix crash when opening video in local playlist tab
This commit is contained in:
Tobias Groza 2020-08-03 15:49:06 +02:00 committed by GitHub
commit eb2f75579a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 14 additions and 21 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

@ -504,7 +504,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");
} }
@ -578,9 +578,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:
@ -633,11 +633,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)));

View File

@ -177,7 +177,7 @@ public class LocalPlaylistFragment extends BaseLocalListFragment<List<PlaylistSt
public void selected(final LocalItem selectedItem) { public void selected(final LocalItem selectedItem) {
if (selectedItem instanceof PlaylistStreamEntry) { if (selectedItem instanceof PlaylistStreamEntry) {
final PlaylistStreamEntry item = (PlaylistStreamEntry) selectedItem; final PlaylistStreamEntry item = (PlaylistStreamEntry) selectedItem;
NavigationHelper.openVideoDetailFragment(getFragmentManager(), NavigationHelper.openVideoDetailFragment(getFM(),
item.getStreamEntity().getServiceId(), item.getStreamEntity().getUrl(), item.getStreamEntity().getServiceId(), item.getStreamEntity().getUrl(),
item.getStreamEntity().getTitle()); item.getStreamEntity().getTitle());
} }