aboutsummaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2015-05-19 09:12:52 -0700
committerScott Jackson <daneren2005@gmail.com>2015-05-19 09:12:52 -0700
commit126c0b9bbeeff47a902df0a4953bfe60b3a57986 (patch)
treee14bf9f9c29cd16cb19b0962b6bb58810b2f546b /app/src
parentdb6a26179784b999c74eecd463d334f9772cc015 (diff)
parent8eb2d63ba03335dd9a3d3b4c9f2a70c1b250b7ba (diff)
downloaddsub-126c0b9bbeeff47a902df0a4953bfe60b3a57986.tar.gz
dsub-126c0b9bbeeff47a902df0a4953bfe60b3a57986.tar.bz2
dsub-126c0b9bbeeff47a902df0a4953bfe60b3a57986.zip
Merge branch 'master' into SlideUpPanel2
Diffstat (limited to 'app/src')
-rw-r--r--app/src/main/AndroidManifest.xml4
-rw-r--r--app/src/main/java/github/daneren2005/dsub/domain/ServerInfo.java2
-rw-r--r--app/src/main/java/github/daneren2005/dsub/fragments/EqualizerFragment.java36
-rw-r--r--app/src/main/java/github/daneren2005/dsub/fragments/NowPlayingFragment.java7
-rw-r--r--app/src/main/java/github/daneren2005/dsub/service/DownloadService.java28
-rw-r--r--app/src/main/java/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java2
-rw-r--r--app/src/main/java/github/daneren2005/dsub/util/Constants.java1
-rw-r--r--app/src/main/java/github/daneren2005/dsub/util/ImageLoader.java6
-rw-r--r--app/src/main/java/github/daneren2005/dsub/util/compat/RemoteControlClientICS.java24
-rw-r--r--app/src/main/java/github/daneren2005/dsub/util/compat/RemoteControlClientJB.java4
-rw-r--r--app/src/main/res/xml/changelog.xml8
11 files changed, 88 insertions, 34 deletions
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 30a6eb3c..38d80ae8 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -2,8 +2,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="github.daneren2005.dsub"
android:installLocation="internalOnly"
- android:versionCode="151"
- android:versionName="4.9.6">
+ android:versionCode="152"
+ android:versionName="4.9.7">
<instrumentation android:name="android.test.InstrumentationTestRunner"
android:targetPackage="github.daneren2005.dsub"
diff --git a/app/src/main/java/github/daneren2005/dsub/domain/ServerInfo.java b/app/src/main/java/github/daneren2005/dsub/domain/ServerInfo.java
index 3ece6af9..07a86db4 100644
--- a/app/src/main/java/github/daneren2005/dsub/domain/ServerInfo.java
+++ b/app/src/main/java/github/daneren2005/dsub/domain/ServerInfo.java
@@ -208,6 +208,6 @@ public class ServerInfo implements Serializable {
}
public static boolean canAlbumListPerFolder(Context context) {
- return ServerInfo.checkServerVersion(context, "1.11") && !ServerInfo.isMadsonic(context);
+ return ServerInfo.checkServerVersion(context, "1.11") && !ServerInfo.isMadsonic(context) && !Util.isTagBrowsing(context);
}
}
diff --git a/app/src/main/java/github/daneren2005/dsub/fragments/EqualizerFragment.java b/app/src/main/java/github/daneren2005/dsub/fragments/EqualizerFragment.java
index b7080a8e..ea61f2c7 100644
--- a/app/src/main/java/github/daneren2005/dsub/fragments/EqualizerFragment.java
+++ b/app/src/main/java/github/daneren2005/dsub/fragments/EqualizerFragment.java
@@ -274,11 +274,15 @@ public class EqualizerFragment extends SubsonicFragment {
bar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
- short level = (short) (progress + minEQLevel);
- if (fromUser) {
- equalizer.setBandLevel(band, (short)(level + masterLevel));
+ try {
+ short level = (short) (progress + minEQLevel);
+ if (fromUser) {
+ equalizer.setBandLevel(band, (short) (level + masterLevel));
+ }
+ updateLevelText(levelTextView, level);
+ } catch(Exception e) {
+ Log.e(TAG, "Failed to change equalizer", e);
}
- updateLevelText(levelTextView, level);
}
@Override
@@ -410,18 +414,22 @@ public class EqualizerFragment extends SubsonicFragment {
bar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
- masterLevel = (short) (progress + minEQLevel);
- if (fromUser) {
- SharedPreferences prefs = Util.getPreferences(context);
- SharedPreferences.Editor editor = prefs.edit();
- editor.putInt(Constants.PREFERENCES_EQUALIZER_SETTINGS, masterLevel);
- editor.commit();
- for (short i = 0; i < equalizer.getNumberOfBands(); i++) {
- short level = (short) ((bars.get(i).getProgress() + minEQLevel) + masterLevel);
- equalizer.setBandLevel(i, level);
+ try {
+ masterLevel = (short) (progress + minEQLevel);
+ if (fromUser) {
+ SharedPreferences prefs = Util.getPreferences(context);
+ SharedPreferences.Editor editor = prefs.edit();
+ editor.putInt(Constants.PREFERENCES_EQUALIZER_SETTINGS, masterLevel);
+ editor.commit();
+ for (short i = 0; i < equalizer.getNumberOfBands(); i++) {
+ short level = (short) ((bars.get(i).getProgress() + minEQLevel) + masterLevel);
+ equalizer.setBandLevel(i, level);
+ }
}
+ updateLevelText(levelTextView, masterLevel);
+ } catch(Exception e) {
+ Log.e(TAG, "Failed to change equalizer", e);
}
- updateLevelText(levelTextView, masterLevel);
}
@Override
diff --git a/app/src/main/java/github/daneren2005/dsub/fragments/NowPlayingFragment.java b/app/src/main/java/github/daneren2005/dsub/fragments/NowPlayingFragment.java
index 6f325a4e..b9ef412c 100644
--- a/app/src/main/java/github/daneren2005/dsub/fragments/NowPlayingFragment.java
+++ b/app/src/main/java/github/daneren2005/dsub/fragments/NowPlayingFragment.java
@@ -573,9 +573,10 @@ public class NowPlayingFragment extends SubsonicFragment implements OnGestureLis
if(equalizerAvailable && !downloadService.isRemoteEnabled()) {
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);
+ if (equalizerOn && downloadService != null) {
+ if(downloadService.getEqualizerController() != null && downloadService.getEqualizerController().isEnabled()) {
+ menu.findItem(R.id.menu_equalizer).setChecked(true);
+ }
}
} else {
menu.removeItem(R.id.menu_equalizer);
diff --git a/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java b/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java
index c1f8870e..c0268933 100644
--- a/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java
+++ b/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java
@@ -42,6 +42,7 @@ import github.daneren2005.dsub.domain.RepeatMode;
import github.daneren2005.dsub.domain.ServerInfo;
import github.daneren2005.dsub.receiver.MediaButtonIntentReceiver;
import github.daneren2005.dsub.util.ArtistRadioBuffer;
+import github.daneren2005.dsub.util.FileUtil;
import github.daneren2005.dsub.util.Notifications;
import github.daneren2005.dsub.util.SilentBackgroundTask;
import github.daneren2005.dsub.util.Constants;
@@ -174,7 +175,27 @@ public class DownloadService extends Service {
mediaPlayer = new MediaPlayer();
mediaPlayer.setWakeMode(DownloadService.this, PowerManager.PARTIAL_WAKE_LOCK);
- mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
+
+ audioSessionId = -1;
+ Integer id = prefs.getInt(Constants.CACHE_AUDIO_SESSION_ID, -1);
+ if(id != -1) {
+ try {
+ audioSessionId = id;
+ mediaPlayer.setAudioSessionId(audioSessionId);
+ } catch (Throwable e) {
+ audioSessionId = -1;
+ }
+ }
+
+ if(audioSessionId == -1) {
+ mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
+ try {
+ audioSessionId = mediaPlayer.getAudioSessionId();
+ prefs.edit().putInt(Constants.CACHE_AUDIO_SESSION_ID, audioSessionId).commit();
+ } catch (Throwable t) {
+ // Froyo or lower
+ }
+ }
mediaPlayer.setOnErrorListener(new MediaPlayer.OnErrorListener() {
@Override
@@ -183,11 +204,6 @@ public class DownloadService extends Service {
return false;
}
});
- try {
- audioSessionId = mediaPlayer.getAudioSessionId();
- } catch(Throwable e) {
- // Froyo or lower
- }
try {
Intent i = new Intent(AudioEffect.ACTION_OPEN_AUDIO_EFFECT_CONTROL_SESSION);
diff --git a/app/src/main/java/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java b/app/src/main/java/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java
index c9f92f41..64da9a13 100644
--- a/app/src/main/java/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java
+++ b/app/src/main/java/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java
@@ -366,7 +366,7 @@ public class DownloadServiceLifecycleSupport {
}
private void handleKeyEvent(KeyEvent event) {
- if(event.getAction() == KeyEvent.ACTION_DOWN) {
+ if(event.getAction() == KeyEvent.ACTION_DOWN && event.getRepeatCount() == 0) {
switch (event.getKeyCode()) {
case RemoteControlClient.FLAG_KEY_MEDIA_PLAY_PAUSE:
case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE:
diff --git a/app/src/main/java/github/daneren2005/dsub/util/Constants.java b/app/src/main/java/github/daneren2005/dsub/util/Constants.java
index 31c5bef2..05481bf0 100644
--- a/app/src/main/java/github/daneren2005/dsub/util/Constants.java
+++ b/app/src/main/java/github/daneren2005/dsub/util/Constants.java
@@ -168,6 +168,7 @@ public final class Constants {
public static final String OFFLINE_STAR_SETTING = "starSetting";
public static final String CACHE_KEY_IGNORE = "ignoreArticles";
+ public static final String CACHE_AUDIO_SESSION_ID = "audioSessionId";
public static final String MAIN_BACK_STACK = "backStackIds";
public static final String MAIN_BACK_STACK_SIZE = "backStackIdsSize";
diff --git a/app/src/main/java/github/daneren2005/dsub/util/ImageLoader.java b/app/src/main/java/github/daneren2005/dsub/util/ImageLoader.java
index 54b4085d..c3d86d4b 100644
--- a/app/src/main/java/github/daneren2005/dsub/util/ImageLoader.java
+++ b/app/src/main/java/github/daneren2005/dsub/util/ImageLoader.java
@@ -88,10 +88,8 @@ public class ImageLoader {
@Override
protected void entryRemoved(boolean evicted, String key, Bitmap oldBitmap, Bitmap newBitmap) {
if(evicted) {
- if(oldBitmap != nowPlaying && key.indexOf("unknown") != 0 || clearingCache) {
- if(sizeOf("", oldBitmap) > 500) {
- oldBitmap.recycle();
- }
+ if(oldBitmap != nowPlaying || clearingCache) {
+ oldBitmap.recycle();
} else {
cache.put(key, oldBitmap);
}
diff --git a/app/src/main/java/github/daneren2005/dsub/util/compat/RemoteControlClientICS.java b/app/src/main/java/github/daneren2005/dsub/util/compat/RemoteControlClientICS.java
index 50283da6..46b6b47d 100644
--- a/app/src/main/java/github/daneren2005/dsub/util/compat/RemoteControlClientICS.java
+++ b/app/src/main/java/github/daneren2005/dsub/util/compat/RemoteControlClientICS.java
@@ -42,17 +42,27 @@ public class RemoteControlClientICS extends RemoteControlClientHelper {
}
public void unregister(final Context context) {
- if (mRemoteControl != null) {
- AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
- audioManager.unregisterRemoteControlClient(mRemoteControl);
+ if(mRemoteControl == null) {
+ return;
}
+
+ AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
+ audioManager.unregisterRemoteControlClient(mRemoteControl);
}
public void setPlaybackState(final int state) {
+ if(mRemoteControl == null) {
+ return;
+ }
+
mRemoteControl.setPlaybackState(state);
}
public void updateMetadata(final Context context, final MusicDirectory.Entry currentSong) {
+ if(mRemoteControl == null) {
+ return;
+ }
+
if(imageLoader == null) {
imageLoader = SubsonicActivity.getStaticImageLoader(context);
}
@@ -72,11 +82,19 @@ public class RemoteControlClientICS extends RemoteControlClientHelper {
@Override
public void registerRoute(MediaRouter router) {
+ if(mRemoteControl == null) {
+ return;
+ }
+
router.addRemoteControlClient(mRemoteControl);
}
@Override
public void unregisterRoute(MediaRouter router) {
+ if(mRemoteControl == null) {
+ return;
+ }
+
router.removeRemoteControlClient(mRemoteControl);
}
diff --git a/app/src/main/java/github/daneren2005/dsub/util/compat/RemoteControlClientJB.java b/app/src/main/java/github/daneren2005/dsub/util/compat/RemoteControlClientJB.java
index c27df2ba..e61e9a47 100644
--- a/app/src/main/java/github/daneren2005/dsub/util/compat/RemoteControlClientJB.java
+++ b/app/src/main/java/github/daneren2005/dsub/util/compat/RemoteControlClientJB.java
@@ -43,6 +43,10 @@ public class RemoteControlClientJB extends RemoteControlClientICS {
@Override
public void setPlaybackState(final int state) {
+ if(mRemoteControl == null) {
+ return;
+ }
+
long position = -1;
if(state == RemoteControlClient.PLAYSTATE_PLAYING || state == RemoteControlClient.PLAYSTATE_PAUSED) {
position = downloadService.getPlayerPosition();
diff --git a/app/src/main/res/xml/changelog.xml b/app/src/main/res/xml/changelog.xml
index 005ddf44..572c1d5b 100644
--- a/app/src/main/res/xml/changelog.xml
+++ b/app/src/main/res/xml/changelog.xml
@@ -1,5 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<changelog>
+ <release version="4.9.7" versioncode="152" releasedate="5/8/2015">
+ <change>Lazy load artist bio information</change>
+ <change>Keep previous search in bar when searching again</change>
+ <change>Warning if trying to stream on mobile if set to stream only on Wifi</change>
+ <change>Fix crash on alphabetical list for some users</change>
+ <change>Hide per folder option for Browse By Tags (Subsonic does not support it)</change>
+ <change>Misc improvements/fixes</change>
+ </release>
<release version="4.9.6" versioncode="150" releasedate="4/20/2015">
<change>New setting: Automatic renaming of duplicate songs</change>
<change>New setting: auto play on headphone insert</change>