Allow to go back to search results list

This commit is contained in:
ByteHamster 2020-10-04 21:53:03 +02:00
parent e9fa84af58
commit dc3b124e0b
4 changed files with 11 additions and 1 deletions

View File

@ -71,6 +71,7 @@ public class MainActivity extends CastEnabledActivity {
public static final String EXTRA_FEED_ID = "fragment_feed_id";
public static final String EXTRA_OPEN_PLAYER = "open_player";
public static final String EXTRA_REFRESH_ON_START = "refresh_on_start";
public static final String EXTRA_STARTED_FROM_SEARCH = "started_from_search";
private @Nullable DrawerLayout drawerLayout;
private @Nullable ActionBarDrawerToggle drawerToggle;
@ -477,8 +478,12 @@ public class MainActivity extends CastEnabledActivity {
if (tag != null) {
loadFragment(tag, args);
} else if (feedId > 0) {
if (intent.getBooleanExtra(EXTRA_STARTED_FROM_SEARCH, false)) {
loadChildFragment(FeedItemlistFragment.newInstance(feedId));
} else {
loadFeedFragmentById(feedId, args);
}
}
sheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
} else if (intent.getBooleanExtra(EXTRA_OPEN_PLAYER, false)) {
sheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);

View File

@ -508,6 +508,8 @@ public class OnlineFeedViewActivity extends AppCompatActivity {
// feed.getId() is always 0, we have to retrieve the id from the feed list from
// the database
Intent intent = MainActivity.getIntentToOpenFeed(this, getFeedId(feed));
intent.putExtra(MainActivity.EXTRA_STARTED_FROM_SEARCH,
getIntent().getBooleanExtra(MainActivity.EXTRA_STARTED_FROM_SEARCH, false));
finish();
startActivity(intent);
}

View File

@ -18,6 +18,7 @@ import android.widget.GridView;
import android.widget.ProgressBar;
import android.widget.TextView;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.MainActivity;
import de.danoeh.antennapod.activity.OnlineFeedViewActivity;
import de.danoeh.antennapod.adapter.itunes.ItunesAdapter;
import de.danoeh.antennapod.discovery.PodcastSearchResult;
@ -101,6 +102,7 @@ public class OnlineSearchFragment extends Fragment {
PodcastSearchResult podcast = searchResults.get(position);
Intent intent = new Intent(getActivity(), OnlineFeedViewActivity.class);
intent.putExtra(OnlineFeedViewActivity.ARG_FEEDURL, podcast.feedUrl);
intent.putExtra(MainActivity.EXTRA_STARTED_FROM_SEARCH, true);
startActivity(intent);
});
progressBar = root.findViewById(R.id.progressBar);

View File

@ -104,6 +104,7 @@ public abstract class PodcastListFragment extends Fragment {
Log.d(TAG, "Selected podcast: " + selection.toString());
Intent intent = new Intent(getActivity(), OnlineFeedViewActivity.class);
intent.putExtra(OnlineFeedViewActivity.ARG_FEEDURL, selection.getUrl());
intent.putExtra(MainActivity.EXTRA_STARTED_FROM_SEARCH, true);
startActivity(intent);
}