From d91b8d023e1e27e6c96fa9051a39e7e15b922402 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Sat, 2 May 2015 14:02:25 -0700 Subject: Fix hardware players sending multiple ACTION_DOWN events --- .../daneren2005/dsub/service/DownloadServiceLifecycleSupport.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/src') 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: -- cgit v1.2.3 From 3b994229df56eb4ea8202b00817b04429758d119 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Mon, 4 May 2015 08:44:55 -0700 Subject: #503 Fix "Per Folder" option showing up when browsing by tags --- app/src/main/java/github/daneren2005/dsub/domain/ServerInfo.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/src') 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); } } -- cgit v1.2.3 From 5946fbdd19ea48a68633d4750920a40fb8f2e961 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Fri, 8 May 2015 15:26:12 -0700 Subject: DSub 4.9.7 Released --- app/src/main/AndroidManifest.xml | 4 ++-- app/src/main/res/xml/changelog.xml | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'app/src') 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 @@ + android:versionCode="152" + android:versionName="4.9.7"> + + Lazy load artist bio information + Keep previous search in bar when searching again + Warning if trying to stream on mobile if set to stream only on Wifi + Fix crash on alphabetical list for some users + Hide per folder option for Browse By Tags (Subsonic does not support it) + Misc improvements/fixes + New setting: Automatic renaming of duplicate songs New setting: auto play on headphone insert -- cgit v1.2.3 From 1bab06f14458468b3d0e7e12ec87c0af7bcea678 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Tue, 12 May 2015 08:34:49 -0700 Subject: Fix crashes if trying to use before properly initialized --- .../dsub/util/compat/RemoteControlClientICS.java | 24 +++++++++++++++++++--- .../dsub/util/compat/RemoteControlClientJB.java | 4 ++++ 2 files changed, 25 insertions(+), 3 deletions(-) (limited to 'app/src') 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(); -- cgit v1.2.3 From ec0fbf498e1506368a057a594d89a8fcbc6503ce Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Tue, 12 May 2015 08:35:10 -0700 Subject: Fix a couple of EQ related crashes --- .../dsub/fragments/EqualizerFragment.java | 36 +++++++++++++--------- 1 file changed, 22 insertions(+), 14 deletions(-) (limited to 'app/src') 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 -- cgit v1.2.3 From 5e90403e4f9dcc4c1dcd415bedadd9cc66a5b830 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Tue, 12 May 2015 08:35:49 -0700 Subject: Recycle small images too now that we use a Recycling fallback ImageView --- app/src/main/java/github/daneren2005/dsub/util/ImageLoader.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'app/src') 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 1a0e8242..7ba2064b 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); } -- cgit v1.2.3 From 7d729d22eb00cebd73d0d74ecce817c3c81f5019 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Mon, 18 May 2015 17:59:21 -0700 Subject: Cache audio session id between plays --- .../daneren2005/dsub/service/DownloadService.java | 29 +++++++++++++++++----- .../github/daneren2005/dsub/util/Constants.java | 1 + 2 files changed, 24 insertions(+), 6 deletions(-) (limited to 'app/src') 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..eb61a579 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,28 @@ 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 + } + } + Log.d(TAG, "Audio session id: " + audioSessionId); mediaPlayer.setOnErrorListener(new MediaPlayer.OnErrorListener() { @Override @@ -183,11 +205,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/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"; -- cgit v1.2.3 From 2d55fbfdc0a01c8c5563827fba6198f1d8c5e4b9 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Mon, 18 May 2015 18:03:52 -0700 Subject: Remove Log.d --- app/src/main/java/github/daneren2005/dsub/service/DownloadService.java | 1 - 1 file changed, 1 deletion(-) (limited to 'app/src') 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 eb61a579..c0268933 100644 --- a/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java +++ b/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java @@ -196,7 +196,6 @@ public class DownloadService extends Service { // Froyo or lower } } - Log.d(TAG, "Audio session id: " + audioSessionId); mediaPlayer.setOnErrorListener(new MediaPlayer.OnErrorListener() { @Override -- cgit v1.2.3 From 8eb2d63ba03335dd9a3d3b4c9f2a70c1b250b7ba Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Mon, 18 May 2015 18:12:57 -0700 Subject: Move getController to separate line in case optimizer is screwing with order of operations --- .../java/github/daneren2005/dsub/fragments/NowPlayingFragment.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'app/src') 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 43d85cdd..3e30af50 100644 --- a/app/src/main/java/github/daneren2005/dsub/fragments/NowPlayingFragment.java +++ b/app/src/main/java/github/daneren2005/dsub/fragments/NowPlayingFragment.java @@ -581,9 +581,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); -- cgit v1.2.3