Add a clear playlist option. Fixes #2

This commit is contained in:
Adam Baker 2016-05-30 19:43:27 +01:00
parent a086c082f5
commit 7a33b529e0
4 changed files with 21 additions and 1 deletions

View file

@ -188,6 +188,9 @@ public class MainActivity extends ActionBarActivity {
case R.id.refreshdev: case R.id.refreshdev:
mServerFragment.triggerSearch(); mServerFragment.triggerSearch();
return true; return true;
case R.id.clearplaylist:
mRouteFragment.clearPlaylist();
return true;
case R.id.about: case R.id.about:
Intent a = new Intent(this, AboutActivity.class); Intent a = new Intent(this, AboutActivity.class);
startActivity(a); startActivity(a);

View file

@ -624,6 +624,17 @@ public class RouteFragment extends MediaRouteDiscoveryFragment implements
mMediaRouterPlayService.append(playlist); mMediaRouterPlayService.append(playlist);
} }
/**
* Deletes the current playlist and stops playback
*/
public void clearPlaylist()
{
mMediaRouterPlayService.stop();
changePlayPauseState(false);
mPlaylistAdapter.clear();
mMediaRouterPlayService.setPlaylist(new ArrayList<Item>());
}
/** /**
* Generates a time string in the format mm:ss from a time value in seconds. * Generates a time string in the format mm:ss from a time value in seconds.
* *

View file

@ -8,6 +8,9 @@
<item <item
android:id="@+id/refreshdev" android:id="@+id/refreshdev"
android:title="@string/refresh_title" /> android:title="@string/refresh_title" />
<item
android:id="@+id/clearplaylist"
android:title="@string/clear_list_title" />
<item <item
android:id="@+id/about" android:id="@+id/about"
android:title="@string/about_title" /> android:title="@string/about_title" />

View file

@ -46,10 +46,13 @@
<!-- Title for the Refresh Devices Action--> <!-- Title for the Refresh Devices Action-->
<string name="refresh_title">Refresh Devices</string> <string name="refresh_title">Refresh Devices</string>
<!-- Title for the Clear Playlist Action-->
<string name="clear_list_title">Clear Playlist</string>
<!-- Title for the About Menu--> <!-- Title for the About Menu-->
<string name="about_title">About</string> <string name="about_title">About</string>
<!-- Title for the About Menu--> <!-- Text for the About Box-->
<string name="about_text">ControlDLNA - a UPnP media control point <string name="about_text">ControlDLNA - a UPnP media control point
\nOriginal version: \nOriginal version:
\nCopyright (c) 2013, Felix Ableitner, All rights reserved. \nCopyright (c) 2013, Felix Ableitner, All rights reserved.