Merge pull request #4294 from ByteHamster/close-player

Close player when selecting sidebar entry
This commit is contained in:
H. Lehmann 2020-07-16 23:19:13 +02:00 committed by GitHub
commit abece8a340
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -19,6 +19,7 @@ import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting; import androidx.annotation.VisibleForTesting;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import com.google.android.material.bottomsheet.BottomSheetBehavior;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.MainActivity; import de.danoeh.antennapod.activity.MainActivity;
import de.danoeh.antennapod.activity.PreferenceActivity; import de.danoeh.antennapod.activity.PreferenceActivity;
@ -371,6 +372,7 @@ public class NavDrawerFragment extends Fragment implements AdapterView.OnItemCli
String tag = navAdapter.getTags().get(position); String tag = navAdapter.getTags().get(position);
if (getActivity() instanceof MainActivity) { if (getActivity() instanceof MainActivity) {
((MainActivity) getActivity()).loadFragment(tag, null); ((MainActivity) getActivity()).loadFragment(tag, null);
((MainActivity) getActivity()).getBottomSheet().setState(BottomSheetBehavior.STATE_COLLAPSED);
} else { } else {
showMainActivity(tag); showMainActivity(tag);
} }
@ -379,6 +381,7 @@ public class NavDrawerFragment extends Fragment implements AdapterView.OnItemCli
long feedId = navDrawerData.feeds.get(pos).getId(); long feedId = navDrawerData.feeds.get(pos).getId();
if (getActivity() instanceof MainActivity) { if (getActivity() instanceof MainActivity) {
((MainActivity) getActivity()).loadFeedFragmentById(feedId, null); ((MainActivity) getActivity()).loadFeedFragmentById(feedId, null);
((MainActivity) getActivity()).getBottomSheet().setState(BottomSheetBehavior.STATE_COLLAPSED);
} else { } else {
Intent intent = new Intent(getActivity(), MainActivity.class); Intent intent = new Intent(getActivity(), MainActivity.class);
intent.putExtra(MainActivity.EXTRA_FEED_ID, feedId); intent.putExtra(MainActivity.EXTRA_FEED_ID, feedId);