diff options
3 files changed, 32 insertions, 11 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java index e3a48c050..0be521f8b 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java @@ -550,7 +550,7 @@ public class MainActivity extends ActionBarActivity implements NavDrawerActivity String lastFragment = getLastNavFragment(); if(!ArrayUtils.contains(NAV_DRAWER_TAGS, lastFragment)) { long feedId = Long.valueOf(lastFragment); - //loadFeedFragmentById(feedId); + loadFeedFragmentById(feedId); saveLastNavFragment(null); } diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/SubscriptionFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/SubscriptionFragment.java index 999da10ab..7f37ea680 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/SubscriptionFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/SubscriptionFragment.java @@ -15,6 +15,7 @@ import de.danoeh.antennapod.R; import de.danoeh.antennapod.activity.MainActivity; import de.danoeh.antennapod.adapter.NavListAdapter; import de.danoeh.antennapod.adapter.SubscriptionsAdapter; +import de.danoeh.antennapod.core.feed.EventDistributor; import de.danoeh.antennapod.core.feed.Feed; import de.danoeh.antennapod.core.storage.DBReader; import de.greenrobot.event.EventBus; @@ -64,7 +65,21 @@ public class SubscriptionFragment extends Fragment { mSubscriptionAdapter = new SubscriptionsAdapter(getActivity(), mItemAccess); mSubscriptionGridLayout.setAdapter(mSubscriptionAdapter); + refreshSubscriptionList(); + mSubscriptionGridLayout.setOnItemClickListener(new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView<?> parent, View view, int position, long id) { + EventBus.getDefault().post(new SubscriptionEvent(mSubscriptionList.get(position))); + } + }); + + if (getActivity() instanceof MainActivity) { + ((MainActivity) getActivity()).getSupportActionBar().setTitle(R.string.my_subscriptions); + } + + } + private void refreshSubscriptionList() { Observable.just(loadData()).subscribe(new Action1<DBReader.NavDrawerData>() { @Override public void call(DBReader.NavDrawerData navDrawerData) { @@ -74,23 +89,28 @@ public class SubscriptionFragment extends Fragment { mSubscriptionAdapter.notifyDataSetChanged(); } }); + } - mSubscriptionGridLayout.setOnItemClickListener(new AdapterView.OnItemClickListener() { - @Override - public void onItemClick(AdapterView<?> parent, View view, int position, long id) { - EventBus.getDefault().post(new SubscriptionEvent(mSubscriptionList.get(position))); + EventDistributor.EventListener updateListener = new EventDistributor.EventListener() { + @Override + public void update(EventDistributor eventDistributor, Integer arg) { + if ((arg & EventDistributor.FEED_LIST_UPDATE) != 0) { + refreshSubscriptionList(); } - }); - - if (getActivity() instanceof MainActivity) { - ((MainActivity) getActivity()).getSupportActionBar().setTitle(R.string.my_subscriptions); } + }; + + @Override + public void onStop() { + super.onStop(); + EventDistributor.getInstance().unregister(updateListener); } @Override public void onResume() { super.onResume(); + EventDistributor.getInstance().register(updateListener); } public class SubscriptionEvent { diff --git a/app/src/main/java/de/danoeh/antennapod/view/SubscriptionViewItem.java b/app/src/main/java/de/danoeh/antennapod/view/SubscriptionViewItem.java index 08d1006f1..ee2567364 100644 --- a/app/src/main/java/de/danoeh/antennapod/view/SubscriptionViewItem.java +++ b/app/src/main/java/de/danoeh/antennapod/view/SubscriptionViewItem.java @@ -13,7 +13,6 @@ import com.squareup.picasso.Picasso; import de.danoeh.antennapod.R; import de.danoeh.antennapod.core.feed.Feed; -import de.danoeh.antennapod.utils.TimeUtils; /** * Custom view for handling feed item. @@ -72,7 +71,9 @@ public class SubscriptionViewItem extends RelativeLayout { } }); mUnreadCountText.setText(unreadCount + ""); - mTextTime.setText(TimeUtils.getTimeAgo(feed.getLastUpdate().getTime(), mContext)); + // Removing the updated time. It could be the latest podcast updated time in the future. + //mTextTime.setText(TimeUtils.getTimeAgo(feed.getLastUpdate().getTime(), mContext)); + mTextTime.setVisibility(GONE); } } |