Skip to content

Commit

Permalink
#405 Reverse changes to shuffle, too much negative feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
daneren2005 committed Nov 2, 2014
1 parent 2565520 commit 393cd13
Show file tree
Hide file tree
Showing 25 changed files with 168 additions and 133 deletions.
Binary file removed res/drawable-hdpi/ic_menu_shuffle_selected.png
Binary file not shown.
Binary file removed res/drawable-mdpi/ic_menu_shuffle_selected.png
Binary file not shown.
Binary file removed res/drawable-xhdpi/ic_menu_shuffle_selected.png
Binary file not shown.
Binary file removed res/drawable-xxhdpi/ic_menu_shuffle_selected.png
Binary file not shown.
4 changes: 2 additions & 2 deletions res/layout/download_media_buttons.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@

<ImageButton
style="@style/PlaybackControl.Small"
android:id="@+id/download_shuffle"
android:src="?attr/shuffle"
android:id="@+id/download_toggle_list"
android:src="?attr/toggle_list"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
/>
Expand Down
12 changes: 6 additions & 6 deletions res/menu/nowplaying.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
xmlns:compat="http://schemas.android.com/apk/res-auto"
android:checkableBehavior="all">

<item
android:id="@+id/menu_shuffle"
android:icon="?attr/shuffle"
android:title="@string/download.menu_shuffle"
compat:showAsAction="ifRoom|withText"/>

<item
android:id="@+id/menu_mediaroute"
compat:actionProviderClass="android.support.v7.app.MediaRouteActionProvider"
compat:actionViewClass="android.support.v7.app.MediaRouteButton"
compat:showAsAction="always"
android:title="@string/menu.cast"/>

<item
android:id="@+id/menu_toggle_list"
android:icon="?attr/toggle_list"
android:title="@string/download.menu_toggle"
compat:showAsAction="ifRoom|withText"/>

<item
android:id="@+id/menu_remove_all"
Expand Down
12 changes: 6 additions & 6 deletions res/menu/nowplaying_offline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:compat="http://schemas.android.com/apk/res-auto">

<item
android:id="@+id/menu_shuffle"
android:icon="?attr/shuffle"
android:title="@string/download.menu_shuffle"
compat:showAsAction="always|withText"/>

<item
android:id="@+id/menu_mediaroute"
compat:actionProviderClass="android.support.v7.app.MediaRouteActionProvider"
compat:actionViewClass="android.support.v7.app.MediaRouteButton"
compat:showAsAction="always"
android:title="@string/menu.cast"/>

<item
android:id="@+id/menu_toggle_list"
android:icon="?attr/toggle_list"
android:title="@string/download.menu_toggle"
compat:showAsAction="always|withText"/>

<item
android:id="@+id/menu_remove_all"
Expand Down
5 changes: 5 additions & 0 deletions res/menu/select_album_context.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
android:id="@+id/album_menu_play_now"
android:title="@string/common.play_now"
/>

<item
android:id="@+id/album_menu_play_shuffled"
android:title="@string/common.play_shuffled"
/>

<group android:id="@+id/hide_play_next">
<item
Expand Down
6 changes: 6 additions & 0 deletions res/menu/select_album_context_offline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
android:id="@+id/album_menu_play_now"
android:title="@string/common.play_now"
/>

<item
android:id="@+id/album_menu_play_shuffled"
android:title="@string/common.play_shuffled"
/>

<group android:id="@+id/hide_play_next">
<item
android:id="@+id/album_menu_play_next"
Expand Down
5 changes: 5 additions & 0 deletions res/menu/select_playlist_context.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
android:title="@string/common.play_now"
/>

<item
android:id="@+id/playlist_menu_play_shuffled"
android:title="@string/common.play_shuffled"
/>

<item
android:id="@+id/playlist_menu_download"
android:title="@string/common.download"
Expand Down
5 changes: 5 additions & 0 deletions res/menu/select_playlist_context_offline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,9 @@
android:id="@+id/playlist_menu_play_now"
android:title="@string/common.play_now"
/>

<item
android:id="@+id/playlist_menu_play_shuffled"
android:title="@string/common.play_shuffled"
/>
</menu>
6 changes: 6 additions & 0 deletions res/menu/select_song.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
android:title="@string/menu.play"
compat:showAsAction="always|withText"/>

<item
android:id="@+id/menu_shuffle"
android:icon="?attr/shuffle"
android:title="@string/menu.shuffle"
compat:showAsAction="ifRoom|withText"/>

<item
android:id="@+id/menu_download"
android:title="@string/common.download"/>
Expand Down
6 changes: 6 additions & 0 deletions res/menu/select_song_offline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
android:title="@string/menu.play"
compat:showAsAction="always|withText"/>

<item
android:id="@+id/menu_shuffle"
android:icon="?attr/shuffle"
android:title="@string/menu.shuffle"
compat:showAsAction="ifRoom|withText"/>

<item
android:id="@+id/menu_delete"
android:title="@string/menu.delete_cache"/>
Expand Down
2 changes: 0 additions & 2 deletions res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,6 @@
<string name="download.downloading_summary_expanded">Current: %1$s
\nEstimated Size: %2$s</string>
<string name="download.failed_to_load">Failed to load</string>
<string name="download.shuffle_on">Shuffle on</string>
<string name="download.shuffle_off">Shuffle off</string>

<string name="sync.new_podcasts">New podcasts available</string>
<string name="sync.new_playlists">New songs in playlists</string>
Expand Down
1 change: 0 additions & 1 deletion res/xml/changelog.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<changelog>
<release version="4.8.2" versioncode="129" releasedate="10/30/2014">
<change>Changed from shuffle option to persistent shuffle toggle</change>
<change>Improve automatic bookmark logic</change>
<change>Tasker: Toggle online/offline</change>
<change>Tasker: Set start/end year + genre for shuffle</change>
Expand Down
90 changes: 39 additions & 51 deletions src/github/daneren2005/dsub/fragments/NowPlayingFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public class NowPlayingFragment extends SubsonicFragment implements OnGestureLis
private View stopButton;
private View startButton;
private ImageButton repeatButton;
private ImageButton shuffleButton;
private View toggleListButton;
private ImageButton starButton;
private ImageButton bookmarkButton;
private ImageButton rateBadButton;
Expand Down Expand Up @@ -187,7 +187,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle bu
bookmarkButton = (ImageButton) rootView.findViewById(R.id.download_bookmark);
rateBadButton = (ImageButton) rootView.findViewById(R.id.download_rating_bad);
rateGoodButton = (ImageButton) rootView.findViewById(R.id.download_rating_good);
shuffleButton = (ImageButton) rootView.findViewById(R.id.download_shuffle);
toggleListButton =rootView.findViewById(R.id.download_toggle_list);

starButton = (ImageButton)rootView.findViewById(R.id.download_star);
if(Util.getPreferences(context).getBoolean(Constants.PREFERENCES_KEY_MENU_STAR, true)) {
Expand Down Expand Up @@ -350,7 +350,7 @@ protected void done(Void result) {
public void onClick(View view) {
RepeatMode repeatMode = getDownloadService().getRepeatMode().next();
getDownloadService().setRepeatMode(repeatMode);
updateButtons();
onDownloadListChanged();
switch (repeatMode) {
case OFF:
Util.toast(context, R.string.download_repeat_off);
Expand Down Expand Up @@ -453,18 +453,11 @@ public void onClick(View view) {
}
});

shuffleButton.setOnClickListener(new View.OnClickListener() {
toggleListButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
DownloadService downloadService = getDownloadService();
downloadService.setShuffleMode(!downloadService.isShuffleMode());
updateButtons();
toggleFullscreenAlbumArt();
setControlsVisible(true);
if(downloadService.isShuffleMode()) {
Util.toast(context, R.string.download_shuffle_on);
} else {
Util.toast(context, R.string.download_shuffle_off);
}
}
});

Expand Down Expand Up @@ -551,7 +544,7 @@ public void remove(int which) {
if (downloadService != null && context.getIntent().getBooleanExtra(Constants.INTENT_EXTRA_NAME_SHUFFLE, false)) {
context.getIntent().removeExtra(Constants.INTENT_EXTRA_NAME_SHUFFLE);
warnIfNetworkOrStorageUnavailable();
downloadService.setShuffleRemote(true);
downloadService.setShufflePlayEnabled(true);
}

if(Build.MODEL.equals("Nexus 4") || Build.MODEL.equals("GT-I9100")) {
Expand Down Expand Up @@ -741,7 +734,7 @@ public void onClick(DialogInterface dialog, int which) {
new SilentBackgroundTask<Void>(context) {
@Override
protected Void doInBackground() throws Throwable {
getDownloadService().setShuffleRemote(false);
getDownloadService().setShufflePlayEnabled(false);
getDownloadService().clear();
return null;
}
Expand Down Expand Up @@ -772,9 +765,19 @@ protected void done(Void result) {
}
context.supportInvalidateOptionsMenu();
return true;
case R.id.menu_toggle_list:
toggleFullscreenAlbumArt();
setControlsVisible(true);
case R.id.menu_shuffle:
new SilentBackgroundTask<Void>(context) {
@Override
protected Void doInBackground() throws Throwable {
getDownloadService().shuffle();
return null;
}

@Override
protected void done(Void result) {
Util.toast(context, R.string.download_menu_shuffle_notification);
}
}.execute();
return true;
case R.id.menu_save_playlist:
List<Entry> entries = new LinkedList<Entry>();
Expand Down Expand Up @@ -946,39 +949,6 @@ private void updateButtons() {
rateBadButton.setVisibility(View.VISIBLE);
rateGoodButton.setVisibility(View.VISIBLE);
}

DownloadService downloadService = getDownloadService();
if(downloadService == null) {
return;
}

switch (downloadService.getRepeatMode()) {
case OFF:
if("light".equals(SubsonicActivity.getThemeName()) | "light_fullscreen".equals(SubsonicActivity.getThemeName())) {
repeatButton.setImageResource(R.drawable.media_repeat_off_light);
} else {
repeatButton.setImageResource(R.drawable.media_repeat_off);
}
break;
case ALL:
repeatButton.setImageResource(R.drawable.media_repeat_all);
break;
case SINGLE:
repeatButton.setImageResource(R.drawable.media_repeat_single);
break;
default:
break;
}

if(downloadService.isShuffleMode()) {
shuffleButton.setImageResource(R.drawable.ic_menu_shuffle_selected);
} else {
if("light".equals(SubsonicActivity.getThemeName())) {
shuffleButton.setImageResource(R.drawable.ic_menu_shuffle_light);
} else {
shuffleButton.setImageResource(R.drawable.ic_menu_shuffle_dark);
}
}
}

// Scroll to current playing/downloading.
Expand Down Expand Up @@ -1143,7 +1113,7 @@ protected void done(Void result) {
List<DownloadFile> list;
list = downloadService.getSongs();

if(downloadService.isShuffleRemote()) {
if(downloadService.isShufflePlayEnabled()) {
emptyTextView.setText(R.string.download_shuffle_loading);
}
else {
Expand All @@ -1162,6 +1132,24 @@ protected void done(Void result) {

emptyTextView.setVisibility(list.isEmpty() ? View.VISIBLE : View.GONE);
currentRevision = downloadService.getDownloadListUpdateRevision();

switch (downloadService.getRepeatMode()) {
case OFF:
if("light".equals(SubsonicActivity.getThemeName()) | "light_fullscreen".equals(SubsonicActivity.getThemeName())) {
repeatButton.setImageResource(R.drawable.media_repeat_off_light);
} else {
repeatButton.setImageResource(R.drawable.media_repeat_off);
}
break;
case ALL:
repeatButton.setImageResource(R.drawable.media_repeat_all);
break;
case SINGLE:
repeatButton.setImageResource(R.drawable.media_repeat_single);
break;
default:
break;
}

if(scrollWhenLoaded) {
scrollToCurrent();
Expand Down
3 changes: 2 additions & 1 deletion src/github/daneren2005/dsub/fragments/SearchFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import android.view.MenuInflater;
import android.view.View;
import android.view.MenuItem;
import android.widget.AbsListView;
import android.widget.AdapterView;
import android.widget.ListAdapter;
import android.widget.ListView;
Expand Down Expand Up @@ -324,7 +325,7 @@ private void onSongSelected(MusicDirectory.Entry song, boolean save, boolean app
if (!append) {
downloadService.clear();
}
downloadService.download(Arrays.asList(song), save, false, playNext);
downloadService.download(Arrays.asList(song), save, false, playNext, false);
if (autoplay) {
downloadService.play(downloadService.size() - 1);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*/
package github.daneren2005.dsub.fragments;

import android.content.DialogInterface;
import android.util.Log;
import android.view.ContextMenu;
import android.view.MenuInflater;
import android.view.MenuItem;
Expand All @@ -28,12 +30,18 @@
import github.daneren2005.dsub.activity.DownloadActivity;
import github.daneren2005.dsub.domain.Bookmark;
import github.daneren2005.dsub.domain.MusicDirectory;
import github.daneren2005.dsub.service.DownloadFile;
import github.daneren2005.dsub.service.DownloadService;
import github.daneren2005.dsub.service.MusicService;
import github.daneren2005.dsub.service.MusicServiceFactory;
import github.daneren2005.dsub.service.OfflineException;
import github.daneren2005.dsub.service.ServerTooOldException;
import github.daneren2005.dsub.util.LoadingTask;
import github.daneren2005.dsub.util.ProgressListener;
import github.daneren2005.dsub.util.SilentBackgroundTask;
import github.daneren2005.dsub.util.Util;
import github.daneren2005.dsub.view.BookmarkAdapter;
import github.daneren2005.dsub.view.SongView;

import java.text.Format;
import java.text.SimpleDateFormat;
Expand Down Expand Up @@ -106,7 +114,7 @@ public void onItemClick(AdapterView<?> parent, View view, int position, long id)
@Override
protected Void doInBackground() throws Throwable {
downloadService.clear();
downloadService.download(Arrays.asList(bookmark), false, true, false, 0, bookmark.getBookmark().getPosition());
downloadService.download(Arrays.asList(bookmark), false, true, false, false, 0, bookmark.getBookmark().getPosition());
return null;
}

Expand Down
Loading

0 comments on commit 393cd13

Please sign in to comment.