summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorByteHamster <ByteHamster@users.noreply.github.com>2024-07-20 16:19:25 +0200
committerGitHub <noreply@github.com>2024-07-20 16:19:25 +0200
commit7d1509f8165a5acc9be3da6d22b41753cb6da2c3 (patch)
treec2245eb7cfd77d7a7868b6ab63e9888e6d751266
parent9d6d37548fcf9ed7584929938d6dd9e1da9106d4 (diff)
downloadAntennaPod-7d1509f8165a5acc9be3da6d22b41753cb6da2c3.zip
Hide 'Not subscribed' message the first time we show preview (#7296)
-rw-r--r--app/src/main/java/de/danoeh/antennapod/ui/screen/feed/FeedItemlistFragment.java9
-rw-r--r--app/src/main/java/de/danoeh/antennapod/ui/screen/onlinefeedview/OnlineFeedViewActivity.java8
-rw-r--r--app/src/main/res/layout/feeditemlist_header.xml3
3 files changed, 15 insertions, 5 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/ui/screen/feed/FeedItemlistFragment.java b/app/src/main/java/de/danoeh/antennapod/ui/screen/feed/FeedItemlistFragment.java
index 2d5d8fa35..0a7b85eac 100644
--- a/app/src/main/java/de/danoeh/antennapod/ui/screen/feed/FeedItemlistFragment.java
+++ b/app/src/main/java/de/danoeh/antennapod/ui/screen/feed/FeedItemlistFragment.java
@@ -87,6 +87,7 @@ public class FeedItemlistFragment extends Fragment implements AdapterView.OnItem
MaterialToolbar.OnMenuItemClickListener, EpisodeItemListAdapter.OnSelectModeListener {
public static final String TAG = "ItemlistFragment";
private static final String ARGUMENT_FEED_ID = "argument.de.danoeh.antennapod.feed_id";
+ private static final String ARGUMENT_IS_FIRST_TIME = "argument.de.danoeh.antennapod.first_time";
private static final String KEY_UP_ARROW = "up_arrow";
protected static final int EPISODES_PER_PAGE = 150;
protected int page = 1;
@@ -98,6 +99,7 @@ public class FeedItemlistFragment extends Fragment implements AdapterView.OnItem
private MoreContentListFooterUtil nextPageLoader;
private boolean displayUpArrow;
private long feedID;
+ private boolean isFirstTime = false;
private Feed feed;
private Disposable disposable;
private FeedItemListFragmentBinding viewBinding;
@@ -110,9 +112,14 @@ public class FeedItemlistFragment extends Fragment implements AdapterView.OnItem
* @return the newly created instance of an ItemlistFragment
*/
public static FeedItemlistFragment newInstance(long feedId) {
+ return newInstance(feedId, false);
+ }
+
+ public static FeedItemlistFragment newInstance(long feedId, boolean isFirstTime) {
FeedItemlistFragment i = new FeedItemlistFragment();
Bundle b = new Bundle();
b.putLong(ARGUMENT_FEED_ID, feedId);
+ b.putBoolean(ARGUMENT_IS_FIRST_TIME, isFirstTime);
i.setArguments(b);
return i;
}
@@ -124,6 +131,7 @@ public class FeedItemlistFragment extends Fragment implements AdapterView.OnItem
Bundle args = getArguments();
Validate.notNull(args);
feedID = args.getLong(ARGUMENT_FEED_ID);
+ isFirstTime = args.getBoolean(ARGUMENT_IS_FIRST_TIME, false);
}
@Nullable
@@ -478,6 +486,7 @@ public class FeedItemlistFragment extends Fragment implements AdapterView.OnItem
if (feed.getState() != Feed.STATE_SUBSCRIBED) {
viewBinding.header.descriptionContainer.setVisibility(View.VISIBLE);
viewBinding.header.headerDescriptionLabel.setText(HtmlToPlainText.getPlainText(feed.getDescription()));
+ viewBinding.header.subscribeNagLabel.setVisibility(isFirstTime ? View.GONE : View.VISIBLE);
} else if (feed.getItemFilter() != null) {
FeedItemFilter filter = feed.getItemFilter();
if (filter.getValues().length > 0) {
diff --git a/app/src/main/java/de/danoeh/antennapod/ui/screen/onlinefeedview/OnlineFeedViewActivity.java b/app/src/main/java/de/danoeh/antennapod/ui/screen/onlinefeedview/OnlineFeedViewActivity.java
index 7e994b1ed..df32bcfb2 100644
--- a/app/src/main/java/de/danoeh/antennapod/ui/screen/onlinefeedview/OnlineFeedViewActivity.java
+++ b/app/src/main/java/de/danoeh/antennapod/ui/screen/onlinefeedview/OnlineFeedViewActivity.java
@@ -234,7 +234,7 @@ public class OnlineFeedViewActivity extends AppCompatActivity {
if (subscribedFeed.getState() == Feed.STATE_SUBSCRIBED) {
openFeed(subscribedFeed.getId());
} else {
- showFeedFragment(subscribedFeed.getId());
+ showFeedFragment(subscribedFeed.getId(), false);
}
}, error -> Log.e(TAG, Log.getStackTraceString(error)), () -> startFeedDownload(url));
return null;
@@ -292,7 +292,7 @@ public class OnlineFeedViewActivity extends AppCompatActivity {
})
.subscribeOn(Schedulers.computation())
.observeOn(AndroidSchedulers.mainThread())
- .subscribe(this::showFeedFragment, error -> {
+ .subscribe(id -> showFeedFragment(id, true), error -> {
error.printStackTrace();
showErrorDialog(error.getMessage(), "");
});
@@ -333,13 +333,13 @@ public class OnlineFeedViewActivity extends AppCompatActivity {
}
}
- private void showFeedFragment(long id) {
+ private void showFeedFragment(long id, boolean isFirstTime) {
if (isFeedFoundBySearch) {
Toast.makeText(this, R.string.no_feed_url_podcast_found_by_search, Toast.LENGTH_LONG).show();
}
viewBinding.progressBar.setVisibility(View.GONE);
- FeedItemlistFragment fragment = FeedItemlistFragment.newInstance(id);
+ FeedItemlistFragment fragment = FeedItemlistFragment.newInstance(id, isFirstTime);
getSupportFragmentManager()
.beginTransaction()
.replace(R.id.fragmentContainer, fragment, FeedItemlistFragment.TAG)
diff --git a/app/src/main/res/layout/feeditemlist_header.xml b/app/src/main/res/layout/feeditemlist_header.xml
index f44a3233e..0c3f75e96 100644
--- a/app/src/main/res/layout/feeditemlist_header.xml
+++ b/app/src/main/res/layout/feeditemlist_header.xml
@@ -200,15 +200,16 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingHorizontal="16dp"
+ android:paddingTop="16dp"
android:background="?android:attr/colorBackground"
android:orientation="vertical"
android:visibility="gone">
<TextView
+ android:id="@+id/subscribeNagLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
- android:layout_marginTop="16dp"
android:paddingHorizontal="16dp"
android:paddingVertical="8dp"
android:background="@drawable/bg_message_info"