summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java13
-rw-r--r--app/src/main/java/de/danoeh/antennapod/config/DownloadServiceCallbacksImpl.java11
-rw-r--r--app/src/main/java/de/danoeh/antennapod/fragment/NavDrawerFragment.java9
3 files changed, 24 insertions, 9 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 f30c3d456..15edec1ce 100644
--- a/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java
+++ b/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java
@@ -76,7 +76,6 @@ public class MainActivity extends CastEnabledActivity {
public static final String PREF_NAME = "MainActivityPrefs";
public static final String PREF_IS_FIRST_LAUNCH = "prefMainActivityIsFirstLaunch";
- public static final String EXTRA_FRAGMENT_TAG = "fragment_tag";
public static final String EXTRA_FRAGMENT_ARGS = "fragment_args";
public static final String EXTRA_FEED_ID = "fragment_feed_id";
public static final String EXTRA_REFRESH_ON_START = "refresh_on_start";
@@ -444,6 +443,9 @@ public class MainActivity extends CastEnabledActivity {
finish();
startActivity(new Intent(this, MainActivity.class));
}
+ if (UserPreferences.getHiddenDrawerItems().contains(NavDrawerFragment.getLastNavFragment(this))) {
+ loadFragment(UserPreferences.getDefaultPage(), null);
+ }
}
@Override
@@ -515,9 +517,10 @@ public class MainActivity extends CastEnabledActivity {
private void handleNavIntent() {
Intent intent = getIntent();
- if (intent.hasExtra(EXTRA_FEED_ID) || intent.hasExtra(EXTRA_FRAGMENT_TAG) || intent.hasExtra(EXTRA_REFRESH_ON_START)) {
+ if (intent.hasExtra(EXTRA_FEED_ID) || intent.hasExtra(MainActivityStarter.EXTRA_FRAGMENT_TAG)
+ || intent.hasExtra(EXTRA_REFRESH_ON_START)) {
Log.d(TAG, "handleNavIntent()");
- String tag = intent.getStringExtra(EXTRA_FRAGMENT_TAG);
+ String tag = intent.getStringExtra(MainActivityStarter.EXTRA_FRAGMENT_TAG);
Bundle args = intent.getBundleExtra(EXTRA_FRAGMENT_ARGS);
boolean refreshOnStart = intent.getBooleanExtra(EXTRA_REFRESH_ON_START, false);
if (refreshOnStart) {
@@ -543,6 +546,10 @@ public class MainActivity extends CastEnabledActivity {
} else if (Intent.ACTION_VIEW.equals(intent.getAction())) {
handleDeeplink(intent.getData());
}
+
+ if (intent.hasExtra(MainActivityStarter.EXTRA_OPEN_DRAWER) && drawerLayout != null) {
+ drawerLayout.open();
+ }
// to avoid handling the intent twice when the configuration changes
setIntent(new Intent(MainActivity.this, MainActivity.class));
}
diff --git a/app/src/main/java/de/danoeh/antennapod/config/DownloadServiceCallbacksImpl.java b/app/src/main/java/de/danoeh/antennapod/config/DownloadServiceCallbacksImpl.java
index 69f112c3b..cc05e14e1 100644
--- a/app/src/main/java/de/danoeh/antennapod/config/DownloadServiceCallbacksImpl.java
+++ b/app/src/main/java/de/danoeh/antennapod/config/DownloadServiceCallbacksImpl.java
@@ -13,16 +13,17 @@ import de.danoeh.antennapod.core.DownloadServiceCallbacks;
import de.danoeh.antennapod.net.download.serviceinterface.DownloadRequest;
import de.danoeh.antennapod.fragment.CompletedDownloadsFragment;
import de.danoeh.antennapod.fragment.QueueFragment;
+import de.danoeh.antennapod.ui.appstartintent.MainActivityStarter;
public class DownloadServiceCallbacksImpl implements DownloadServiceCallbacks {
@Override
public PendingIntent getNotificationContentIntent(Context context) {
- Intent intent = new Intent(context, MainActivity.class);
- intent.putExtra(MainActivity.EXTRA_FRAGMENT_TAG, CompletedDownloadsFragment.TAG);
+ MainActivityStarter starter = new MainActivityStarter(context)
+ .withFragmentLoaded(CompletedDownloadsFragment.TAG);
return PendingIntent.getActivity(context,
- R.id.pending_intent_download_service_notification, intent,
+ R.id.pending_intent_download_service_notification, starter.getIntent(),
PendingIntent.FLAG_UPDATE_CURRENT | (Build.VERSION.SDK_INT >= 23 ? PendingIntent.FLAG_IMMUTABLE : 0));
}
@@ -39,7 +40,7 @@ public class DownloadServiceCallbacksImpl implements DownloadServiceCallbacks {
@Override
public PendingIntent getReportNotificationContentIntent(Context context) {
Intent intent = new Intent(context, MainActivity.class);
- intent.putExtra(MainActivity.EXTRA_FRAGMENT_TAG, CompletedDownloadsFragment.TAG);
+ intent.putExtra(MainActivityStarter.EXTRA_FRAGMENT_TAG, CompletedDownloadsFragment.TAG);
Bundle args = new Bundle();
args.putBoolean(CompletedDownloadsFragment.ARG_SHOW_LOGS, true);
intent.putExtra(MainActivity.EXTRA_FRAGMENT_ARGS, args);
@@ -50,7 +51,7 @@ public class DownloadServiceCallbacksImpl implements DownloadServiceCallbacks {
@Override
public PendingIntent getAutoDownloadReportNotificationContentIntent(Context context) {
Intent intent = new Intent(context, MainActivity.class);
- intent.putExtra(MainActivity.EXTRA_FRAGMENT_TAG, QueueFragment.TAG);
+ intent.putExtra(MainActivityStarter.EXTRA_FRAGMENT_TAG, QueueFragment.TAG);
return PendingIntent.getActivity(context, R.id.pending_intent_download_service_autodownload_report, intent,
PendingIntent.FLAG_UPDATE_CURRENT | (Build.VERSION.SDK_INT >= 23 ? PendingIntent.FLAG_IMMUTABLE : 0));
}
diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/NavDrawerFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/NavDrawerFragment.java
index 7c3ed4f2f..2d0b9fe99 100644
--- a/app/src/main/java/de/danoeh/antennapod/fragment/NavDrawerFragment.java
+++ b/app/src/main/java/de/danoeh/antennapod/fragment/NavDrawerFragment.java
@@ -40,6 +40,7 @@ import de.danoeh.antennapod.event.FeedListUpdateEvent;
import de.danoeh.antennapod.event.QueueEvent;
import de.danoeh.antennapod.event.UnreadItemsUpdateEvent;
import de.danoeh.antennapod.model.feed.Feed;
+import de.danoeh.antennapod.ui.appstartintent.MainActivityStarter;
import de.danoeh.antennapod.ui.home.HomeFragment;
import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
@@ -338,7 +339,13 @@ public class NavDrawerFragment extends Fragment implements SharedPreferences.OnS
@Override
public boolean onItemLongClick(int position) {
if (position < navAdapter.getFragmentTags().size()) {
- DrawerPreferencesDialog.show(getContext(), () -> navAdapter.notifyDataSetChanged());
+ DrawerPreferencesDialog.show(getContext(), () -> {
+ navAdapter.notifyDataSetChanged();
+ if (UserPreferences.getHiddenDrawerItems().contains(getLastNavFragment(getContext()))) {
+ new MainActivityStarter(getContext())
+ .withFragmentLoaded(UserPreferences.getDefaultPage()).start();
+ }
+ });
return true;
} else {
contextPressedItem = flatItemList.get(position - navAdapter.getSubscriptionOffset());