diff --git a/src/com/github/nutomic/controldlna/gui/MainActivity.java b/src/com/github/nutomic/controldlna/gui/MainActivity.java index 249ae57..46785e2 100644 --- a/src/com/github/nutomic/controldlna/gui/MainActivity.java +++ b/src/com/github/nutomic/controldlna/gui/MainActivity.java @@ -32,6 +32,7 @@ import java.util.List; import org.teleal.cling.support.model.item.Item; import android.app.AlertDialog; +import android.content.Intent; import android.content.SharedPreferences; import android.net.ConnectivityManager; import android.net.NetworkInfo; @@ -99,7 +100,8 @@ public class MainActivity extends ActionBarActivity { * shows a warning dialog. */ public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); + super.onCreate(savedInstanceState); + onNewIntent(getIntent()); final ActionBar actionBar = getSupportActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); @@ -194,6 +196,15 @@ public class MainActivity extends ActionBarActivity { mRouteFragment = new RouteFragment(); } } + + /** + * Displays the RouteFragment immediately (instead of ServerFragment). + */ + @Override + protected void onNewIntent(Intent intent) { + if (intent.getAction().equals("showRouteFragment")) + mViewPager.setCurrentItem(1); + } /** * Saves fragments. diff --git a/src/com/github/nutomic/controldlna/gui/RouteFragment.java b/src/com/github/nutomic/controldlna/gui/RouteFragment.java index a8f3264..b400977 100644 --- a/src/com/github/nutomic/controldlna/gui/RouteFragment.java +++ b/src/com/github/nutomic/controldlna/gui/RouteFragment.java @@ -485,7 +485,6 @@ public class RouteFragment extends MediaRouteDiscoveryFragment implements if (mListView.getAdapter() == mPlaylistAdapter) enableTrackHighlight(); - } } diff --git a/src/com/github/nutomic/controldlna/mediarouter/MediaRouterPlayService.java b/src/com/github/nutomic/controldlna/mediarouter/MediaRouterPlayService.java index d53fff7..4485c5a 100644 --- a/src/com/github/nutomic/controldlna/mediarouter/MediaRouterPlayService.java +++ b/src/com/github/nutomic/controldlna/mediarouter/MediaRouterPlayService.java @@ -131,9 +131,11 @@ public class MediaRouterPlayService extends Service { artist = track.getArtists()[0].getName(); } } + Intent intent = new Intent(MediaRouterPlayService.this, MainActivity.class); + intent.setAction("showRouteFragment"); Notification notification = new NotificationCompat.Builder(MediaRouterPlayService.this) .setContentIntent(PendingIntent.getActivity(MediaRouterPlayService.this, 0, - new Intent(MediaRouterPlayService.this, MainActivity.class), 0)) + intent, 0)) .setContentTitle(title) .setContentText(artist) .setLargeIcon(result)