aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2014-08-31 10:23:37 -0700
committerScott Jackson <daneren2005@gmail.com>2014-08-31 10:23:37 -0700
commitca44dbc7ef9c9657c4b96add002a3149f0cb1c7e (patch)
tree50ef0679885d7e0a3830ad26923a53168e0eb7e7
parent5ae23c33d575eefeaefac934b8f575a83bf2f9de (diff)
downloaddsub-ca44dbc7ef9c9657c4b96add002a3149f0cb1c7e.tar.gz
dsub-ca44dbc7ef9c9657c4b96add002a3149f0cb1c7e.tar.bz2
dsub-ca44dbc7ef9c9657c4b96add002a3149f0cb1c7e.zip
Move the EQ into the options menu
-rw-r--r--res/layout-land/download.xml5
-rw-r--r--res/layout-large-land/download.xml13
-rw-r--r--res/layout-port/download.xml5
-rw-r--r--res/menu/nowplaying.xml5
-rw-r--r--res/menu/nowplaying_offline.xml8
-rw-r--r--src/github/daneren2005/dsub/fragments/NowPlayingFragment.java67
6 files changed, 56 insertions, 47 deletions
diff --git a/res/layout-land/download.xml b/res/layout-land/download.xml
index c17abbc4..7dc852e1 100644
--- a/res/layout-land/download.xml
+++ b/res/layout-land/download.xml
@@ -70,11 +70,6 @@
android:src="?attr/rating_bad"/>
<Button
- android:id="@+id/download_equalizer"
- android:text="EQ"
- style="@style/DownloadActionButton"/>
-
- <Button
android:id="@+id/download_visualizer"
android:text="VIS"
style="@style/DownloadActionButton"/>
diff --git a/res/layout-large-land/download.xml b/res/layout-large-land/download.xml
index e1572890..89fa08e5 100644
--- a/res/layout-large-land/download.xml
+++ b/res/layout-large-land/download.xml
@@ -60,10 +60,10 @@
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true">
- <Button
- android:id="@+id/download_equalizer"
- android:text="EQ"
- style="@style/DownloadActionButton"/>
+ <ImageButton
+ android:id="@+id/download_rating_bad"
+ style="@style/DownloadActionImageButton"
+ android:src="?attr/rating_bad"/>
<Button
android:id="@+id/download_visualizer"
@@ -79,6 +79,11 @@
android:id="@+id/download_bookmark"
style="@style/DownloadActionImageButton"
android:src="?attr/bookmark"/>
+
+ <ImageButton
+ android:id="@+id/download_rating_good"
+ style="@style/DownloadActionImageButton"
+ android:src="?attr/rating_good"/>
</LinearLayout>
</RelativeLayout>
diff --git a/res/layout-port/download.xml b/res/layout-port/download.xml
index 7cce6747..916f3f25 100644
--- a/res/layout-port/download.xml
+++ b/res/layout-port/download.xml
@@ -61,11 +61,6 @@
android:src="@drawable/ic_action_rating_bad_dark"/>
<Button
- android:id="@+id/download_equalizer"
- android:text="EQ"
- style="@style/DownloadActionButton"/>
-
- <Button
android:id="@+id/download_visualizer"
android:text="VIS"
style="@style/DownloadActionButton"/>
diff --git a/res/menu/nowplaying.xml b/res/menu/nowplaying.xml
index 48528b43..60255692 100644
--- a/res/menu/nowplaying.xml
+++ b/res/menu/nowplaying.xml
@@ -28,6 +28,11 @@
android:title="@string/download.menu_save"
compat:showAsAction="ifRoom|withText"/>
+ <item
+ android:id="@+id/menu_equalizer"
+ android:title="@string/equalizer.label"
+ android:checkable="true"/>
+
<item
android:id="@+id/menu_screen_on_off"
android:title="@string/download.menu_screen_on"
diff --git a/res/menu/nowplaying_offline.xml b/res/menu/nowplaying_offline.xml
index f3912b0c..bba5ba00 100644
--- a/res/menu/nowplaying_offline.xml
+++ b/res/menu/nowplaying_offline.xml
@@ -20,10 +20,16 @@
android:icon="?attr/remove"
android:title="@string/download.menu_remove_all"
compat:showAsAction="ifRoom|withText"/>
+
+ <item
+ android:id="@+id/menu_equalizer"
+ android:title="@string/equalizer.label"
+ android:checkable="true"/>
<item
android:id="@+id/menu_screen_on_off"
- android:title="@string/download.menu_screen_on"/>
+ android:title="@string/download.menu_screen_on"
+ android:checkable="true"/>
<item
android:id="@+id/menu_remove_played"
diff --git a/src/github/daneren2005/dsub/fragments/NowPlayingFragment.java b/src/github/daneren2005/dsub/fragments/NowPlayingFragment.java
index b24fa7f2..150c11b3 100644
--- a/src/github/daneren2005/dsub/fragments/NowPlayingFragment.java
+++ b/src/github/daneren2005/dsub/fragments/NowPlayingFragment.java
@@ -111,7 +111,6 @@ public class NowPlayingFragment extends SubsonicFragment implements OnGestureLis
private View stopButton;
private View startButton;
private ImageButton repeatButton;
- private Button equalizerButton;
private Button visualizerButton;
private View toggleListButton;
private ImageButton starButton;
@@ -187,7 +186,6 @@ public class NowPlayingFragment extends SubsonicFragment implements OnGestureLis
stopButton =rootView.findViewById(R.id.download_stop);
startButton =rootView.findViewById(R.id.download_start);
repeatButton = (ImageButton)rootView.findViewById(R.id.download_repeat);
- equalizerButton = (Button)rootView.findViewById(R.id.download_equalizer);
visualizerButton = (Button)rootView.findViewById(R.id.download_visualizer);
bookmarkButton = (ImageButton) rootView.findViewById(R.id.download_bookmark);
rateBadButton = (ImageButton) rootView.findViewById(R.id.download_rating_bad);
@@ -221,9 +219,10 @@ public class NowPlayingFragment extends SubsonicFragment implements OnGestureLis
pauseButton.setOnTouchListener(touchListener);
stopButton.setOnTouchListener(touchListener);
startButton.setOnTouchListener(touchListener);
- equalizerButton.setOnTouchListener(touchListener);
visualizerButton.setOnTouchListener(touchListener);
bookmarkButton.setOnTouchListener(touchListener);
+ rateBadButton.setOnTouchListener(touchListener);
+ rateGoodButton.setOnTouchListener(touchListener);
emptyTextView.setOnTouchListener(touchListener);
albumArtImageView.setOnTouchListener(new View.OnTouchListener() {
@Override
@@ -370,21 +369,6 @@ public class NowPlayingFragment extends SubsonicFragment implements OnGestureLis
}
});
- equalizerButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- DownloadService downloadService = getDownloadService();
- if(downloadService != null && downloadService.getEqualizerController() != null
- && downloadService.getEqualizerController().getEqualizer() != null) {
- SubsonicFragment fragment = new EqualizerFragment();
- replaceFragment(fragment);
- setControlsVisible(true);
- } else {
- Util.toast(context, "Failed to start equalizer. Try restarting.");
- }
- }
- });
-
visualizerButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
@@ -538,7 +522,6 @@ public class NowPlayingFragment extends SubsonicFragment implements OnGestureLis
boolean equalizerAvailable = downloadService != null && downloadService.getEqualizerAvailable();
if (!equalizerAvailable) {
- equalizerButton.setVisibility(View.GONE);
visualizerButton.setVisibility(View.GONE);
} else {
visualizerView = new VisualizerView(context);
@@ -574,6 +557,19 @@ public class NowPlayingFragment extends SubsonicFragment implements OnGestureLis
if(downloadService != null && downloadService.isRemovePlayed()) {
menu.findItem(R.id.menu_remove_played).setChecked(true);
}
+
+ boolean equalizerAvailable = downloadService != null && downloadService.getEqualizerAvailable();
+ if(equalizerAvailable) {
+ SharedPreferences prefs = Util.getPreferences(context);
+ boolean equalizerOn = prefs.getBoolean(Constants.PREFERENCES_EQUALIZER_ON, false);
+ if (equalizerOn && getDownloadService() != null && getDownloadService().getEqualizerController() != null &&
+ getDownloadService().getEqualizerController().isEnabled()) {
+ menu.findItem(R.id.menu_equalizer).setChecked(true);
+ }
+ } else {
+ menu.removeItem(R.id.menu_equalizer);
+ }
+
if(downloadService != null) {
MenuItem mediaRouteItem = menu.findItem(R.id.menu_mediaroute);
if(mediaRouteItem != null) {
@@ -687,16 +683,16 @@ public class NowPlayingFragment extends SubsonicFragment implements OnGestureLis
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
Util.startActivityWithoutTransition(context, intent);
return true;
- case R.id.menu_lyrics:
+ case R.id.menu_lyrics: {
SubsonicFragment fragment = new LyricsFragment();
Bundle args = new Bundle();
args.putString(Constants.INTENT_EXTRA_NAME_ARTIST, song.getSong().getArtist());
args.putString(Constants.INTENT_EXTRA_NAME_TITLE, song.getSong().getTitle());
fragment.setArguments(args);
-
+
replaceFragment(fragment);
return true;
- case R.id.menu_remove:
+ } case R.id.menu_remove:
new SilentBackgroundTask<Void>(context) {
@Override
protected Void doInBackground() throws Throwable {
@@ -797,7 +793,19 @@ public class NowPlayingFragment extends SubsonicFragment implements OnGestureLis
songs = new ArrayList<Entry>(1);
songs.add(song.getSong());
createShare(songs);
- default:
+ return true;
+ case R.id.menu_equalizer: {
+ DownloadService downloadService = getDownloadService();
+ if (downloadService != null && downloadService.getEqualizerController() != null
+ && downloadService.getEqualizerController().getEqualizer() != null) {
+ SubsonicFragment fragment = new EqualizerFragment();
+ replaceFragment(fragment);
+ setControlsVisible(true);
+ } else {
+ Util.toast(context, "Failed to start equalizer. Try restarting.");
+ }
+ return true;
+ } default:
return false;
}
}
@@ -911,23 +919,18 @@ public class NowPlayingFragment extends SubsonicFragment implements OnGestureLis
return;
}
- SharedPreferences prefs = Util.getPreferences(context);
- boolean equalizerOn = prefs.getBoolean(Constants.PREFERENCES_EQUALIZER_ON, false);
- if(equalizerOn && getDownloadService() != null && getDownloadService().getEqualizerController() != null &&
- getDownloadService().getEqualizerController().isEnabled()) {
- equalizerButton.setTextColor(COLOR_BUTTON_ENABLED);
- } else {
- equalizerButton.setTextColor(COLOR_BUTTON_DISABLED);
- }
-
if (visualizerView != null) {
visualizerButton.setTextColor(visualizerView.isActive() ? COLOR_BUTTON_ENABLED : COLOR_BUTTON_DISABLED);
}
if(Util.isOffline(context)) {
bookmarkButton.setVisibility(View.GONE);
+ rateBadButton.setVisibility(View.GONE);
+ rateGoodButton.setVisibility(View.GONE);
} else {
bookmarkButton.setVisibility(View.VISIBLE);
+ rateBadButton.setVisibility(View.VISIBLE);
+ rateGoodButton.setVisibility(View.VISIBLE);
}
}