-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add lazy loading to feed item list (#7091)
- Loading branch information
1 parent
04fab47
commit f3bca9d
Showing
18 changed files
with
167 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
app/src/main/java/de/danoeh/antennapod/ui/screen/feed/SingleFeedSortDialog.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package de.danoeh.antennapod.ui.screen.feed; | ||
|
||
import android.os.Bundle; | ||
import androidx.annotation.Nullable; | ||
import de.danoeh.antennapod.model.feed.Feed; | ||
import de.danoeh.antennapod.model.feed.SortOrder; | ||
import de.danoeh.antennapod.storage.database.DBWriter; | ||
|
||
public class SingleFeedSortDialog extends ItemSortDialog { | ||
private static final String ARG_FEED_ID = "feedId"; | ||
private static final String ARG_FEED_IS_LOCAL = "isLocal"; | ||
private static final String ARG_SORT_ORDER = "sortOrder"; | ||
|
||
public static SingleFeedSortDialog newInstance(Feed feed) { | ||
Bundle bundle = new Bundle(); | ||
bundle.putLong(ARG_FEED_ID, feed.getId()); | ||
bundle.putBoolean(ARG_FEED_IS_LOCAL, feed.isLocalFeed()); | ||
if (feed.getSortOrder() == null) { | ||
bundle.putString(ARG_SORT_ORDER, String.valueOf(SortOrder.DATE_NEW_OLD.code)); | ||
} else { | ||
bundle.putString(ARG_SORT_ORDER, String.valueOf(feed.getSortOrder().code)); | ||
} | ||
SingleFeedSortDialog dialog = new SingleFeedSortDialog(); | ||
dialog.setArguments(bundle); | ||
return dialog; | ||
} | ||
|
||
@Override | ||
public void onCreate(@Nullable Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
sortOrder = SortOrder.fromCodeString(getArguments().getString(ARG_SORT_ORDER)); | ||
} | ||
|
||
@Override | ||
protected void onAddItem(int title, SortOrder ascending, SortOrder descending, boolean ascendingIsDefault) { | ||
if (ascending == SortOrder.DATE_OLD_NEW || ascending == SortOrder.DURATION_SHORT_LONG | ||
|| ascending == SortOrder.EPISODE_TITLE_A_Z | ||
|| (getArguments().getBoolean(ARG_FEED_IS_LOCAL) && ascending == SortOrder.EPISODE_FILENAME_A_Z)) { | ||
super.onAddItem(title, ascending, descending, ascendingIsDefault); | ||
} | ||
} | ||
|
||
@Override | ||
protected void onSelectionChanged() { | ||
super.onSelectionChanged(); | ||
DBWriter.setFeedItemSortOrder(getArguments().getLong(ARG_FEED_ID), sortOrder); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.