Changed notification to always shouw route fragment.
This commit is contained in:
parent
8a08fb00ec
commit
cc2fda0166
3 changed files with 15 additions and 3 deletions
|
@ -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.
|
||||
|
|
|
@ -485,7 +485,6 @@ public class RouteFragment extends MediaRouteDiscoveryFragment implements
|
|||
|
||||
if (mListView.getAdapter() == mPlaylistAdapter)
|
||||
enableTrackHighlight();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
Reference in a new issue