aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/build.gradle2
-rw-r--r--app/src/main/AndroidManifest.xml2
-rw-r--r--app/src/main/java/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java4
-rw-r--r--app/src/main/java/github/daneren2005/dsub/domain/MusicDirectory.java4
-rw-r--r--app/src/main/java/github/daneren2005/dsub/domain/ServerInfo.java8
-rw-r--r--app/src/main/java/github/daneren2005/dsub/fragments/SubsonicFragment.java4
-rw-r--r--app/src/main/java/github/daneren2005/dsub/provider/DSubWidgetProvider.java2
-rw-r--r--app/src/main/java/github/daneren2005/dsub/service/DownloadService.java5
-rw-r--r--app/src/main/java/github/daneren2005/dsub/service/parser/AbstractParser.java14
-rw-r--r--app/src/main/java/github/daneren2005/dsub/util/Notifications.java9
-rw-r--r--app/src/main/java/github/daneren2005/dsub/util/SongDBHandler.java1
-rw-r--r--app/src/main/java/github/daneren2005/dsub/util/compat/RemoteControlClientLP.java2
-rw-r--r--app/src/main/java/github/daneren2005/dsub/view/UpdateView.java4
13 files changed, 47 insertions, 14 deletions
diff --git a/app/build.gradle b/app/build.gradle
index 2cf18f0e..ec714e76 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -9,7 +9,7 @@ android {
applicationId "github.daneren2005.dsub"
minSdkVersion 14
targetSdkVersion 22
- versionCode 177
+ versionCode 178
versionName '5.1.7'
setProperty("archivesBaseName", "DSub $versionName")
}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 4293ba8e..999fb150 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -41,7 +41,7 @@
<activity android:name="github.daneren2005.dsub.activity.SubsonicFragmentActivity"
android:configChanges="orientation|keyboardHidden"
- android:launchMode="standard">
+ android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
diff --git a/app/src/main/java/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java b/app/src/main/java/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java
index 8273f61c..630cdd50 100644
--- a/app/src/main/java/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java
+++ b/app/src/main/java/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java
@@ -412,6 +412,10 @@ public class SubsonicFragmentActivity extends SubsonicActivity implements Downlo
SearchFragment fragment = new SearchFragment();
replaceFragment(fragment, fragment.getSupportTag());
}
+ } else if(intent.getBooleanExtra(Constants.INTENT_EXTRA_NAME_DOWNLOAD, false)) {
+ if(slideUpPanel.getPanelState() != SlidingUpPanelLayout.PanelState.EXPANDED) {
+ openNowPlaying();
+ }
} else {
setIntent(intent);
}
diff --git a/app/src/main/java/github/daneren2005/dsub/domain/MusicDirectory.java b/app/src/main/java/github/daneren2005/dsub/domain/MusicDirectory.java
index 4df56022..1da3d51b 100644
--- a/app/src/main/java/github/daneren2005/dsub/domain/MusicDirectory.java
+++ b/app/src/main/java/github/daneren2005/dsub/domain/MusicDirectory.java
@@ -309,6 +309,10 @@ public class MusicDirectory implements Serializable {
public void rebaseTitleOffPath() {
try {
String filename = getPath();
+ if(filename == null) {
+ return;
+ }
+
int index = filename.lastIndexOf('/');
if (index != -1) {
filename = filename.substring(index + 1);
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 73037c4a..e4c9b17d 100644
--- a/app/src/main/java/github/daneren2005/dsub/domain/ServerInfo.java
+++ b/app/src/main/java/github/daneren2005/dsub/domain/ServerInfo.java
@@ -35,6 +35,7 @@ import github.daneren2005.dsub.util.Util;
public class ServerInfo implements Serializable {
public static final int TYPE_SUBSONIC = 1;
public static final int TYPE_MADSONIC = 2;
+ public static final int TYPE_AMPACHE = 3;
private static final Map<Integer, ServerInfo> SERVERS = new ConcurrentHashMap<Integer, ServerInfo>();
private boolean isLicenseValid;
@@ -189,6 +190,13 @@ public class ServerInfo implements Serializable {
public static boolean isMadsonic6(Context context, int instance) {
return getServerType(context, instance) == TYPE_MADSONIC && checkServerVersion(context, "2.0", instance);
}
+
+ public static boolean isAmpache(Context context) {
+ return isAmpache(context, Util.getActiveServer(context));
+ }
+ public static boolean isAmpache(Context context, int instance) {
+ return getServerType(context, instance) == TYPE_AMPACHE;
+ }
private static String getCacheName(Context context, int instance) {
return "server-" + Util.getRestUrl(context, null, instance, false).hashCode() + ".ser";
diff --git a/app/src/main/java/github/daneren2005/dsub/fragments/SubsonicFragment.java b/app/src/main/java/github/daneren2005/dsub/fragments/SubsonicFragment.java
index 9bbc6f85..f733c977 100644
--- a/app/src/main/java/github/daneren2005/dsub/fragments/SubsonicFragment.java
+++ b/app/src/main/java/github/daneren2005/dsub/fragments/SubsonicFragment.java
@@ -1588,7 +1588,7 @@ public class SubsonicFragment extends Fragment implements SwipeRefreshLayout.OnR
.setPositiveButton(R.string.bookmark_action_resume, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
- playNow(songs, song, position);
+ playNow(songs, song, position, playlistName, playlistId);
}
})
.setNegativeButton(R.string.bookmark_action_start_over, new DialogInterface.OnClickListener() {
@@ -1621,7 +1621,7 @@ public class SubsonicFragment extends Fragment implements SwipeRefreshLayout.OnR
}
}.execute();
- playNow(songs, 0);
+ playNow(songs, 0, playlistName, playlistId);
}
});
AlertDialog dialog = builder.create();
diff --git a/app/src/main/java/github/daneren2005/dsub/provider/DSubWidgetProvider.java b/app/src/main/java/github/daneren2005/dsub/provider/DSubWidgetProvider.java
index 18660fa2..5c90c250 100644
--- a/app/src/main/java/github/daneren2005/dsub/provider/DSubWidgetProvider.java
+++ b/app/src/main/java/github/daneren2005/dsub/provider/DSubWidgetProvider.java
@@ -278,7 +278,7 @@ public class DSubWidgetProvider extends AppWidgetProvider {
private void linkButtons(Context context, RemoteViews views, boolean playerActive) {
Intent intent = new Intent(context, SubsonicFragmentActivity.class);
intent.putExtra(Constants.INTENT_EXTRA_NAME_DOWNLOAD, true);
- intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
+ intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
views.setOnClickPendingIntent(R.id.appwidget_coverart, pendingIntent);
views.setOnClickPendingIntent(R.id.appwidget_top, pendingIntent);
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 988dea5f..f1cebaef 100644
--- a/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java
+++ b/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java
@@ -864,7 +864,10 @@ public class DownloadService extends Service {
if (currentPlaying != null && currentPlaying.getSong() != null) {
Util.broadcastNewTrackInfo(this, currentPlaying.getSong());
- mRemoteControl.updateMetadata(this, currentPlaying.getSong());
+
+ if(mRemoteControl != null) {
+ mRemoteControl.updateMetadata(this, currentPlaying.getSong());
+ }
} else {
Util.broadcastNewTrackInfo(this, null);
Notifications.hidePlayingNotification(this, this, handler);
diff --git a/app/src/main/java/github/daneren2005/dsub/service/parser/AbstractParser.java b/app/src/main/java/github/daneren2005/dsub/service/parser/AbstractParser.java
index 664adcfb..4ee37dad 100644
--- a/app/src/main/java/github/daneren2005/dsub/service/parser/AbstractParser.java
+++ b/app/src/main/java/github/daneren2005/dsub/service/parser/AbstractParser.java
@@ -36,6 +36,12 @@ import github.daneren2005.dsub.util.Util;
*/
public abstract class AbstractParser {
private static final String TAG = AbstractParser.class.getSimpleName();
+ private static final String SUBSONIC_RESPONSE = "subsonic-response";
+ private static final String MADSONIC_RESPONSE = "madsonic-response";
+ private static final String SUBSONIC = "subsonic";
+ private static final String MADSONIC = "madsonic";
+ private static final String AMPACHE = "ampache";
+
protected final Context context;
protected final int instance;
private XmlPullParser parser;
@@ -132,16 +138,18 @@ public abstract class AbstractParser {
protected String getElementName() {
String name = parser.getName();
- if ("subsonic-response".equals(name) || "madsonic-response".equals(name)) {
+ if (SUBSONIC_RESPONSE.equals(name) || MADSONIC_RESPONSE.equals(name)) {
rootElementFound = true;
String version = get("version");
if (version != null) {
ServerInfo server = new ServerInfo();
server.setRestVersion(new Version(version));
- if("madsonic".equals(get("type")) || "madsonic-response".equals(name)) {
+ if(MADSONIC.equals(get("type")) || MADSONIC_RESPONSE.equals(name)) {
server.setRestType(ServerInfo.TYPE_MADSONIC);
- } else if("subsonic".equals(get("type")) && server.checkServerVersion(context, "1.13")) {
+ } if(AMPACHE.equals(get("type"))) {
+ server.setRestType(ServerInfo.TYPE_AMPACHE);
+ } else if(SUBSONIC.equals(get("type")) && server.checkServerVersion(context, "1.13")) {
// Oh am I going to regret this
server.setRestType(ServerInfo.TYPE_MADSONIC);
server.setRestVersion(new Version("2.0.0"));
diff --git a/app/src/main/java/github/daneren2005/dsub/util/Notifications.java b/app/src/main/java/github/daneren2005/dsub/util/Notifications.java
index 1ec18905..2948844b 100644
--- a/app/src/main/java/github/daneren2005/dsub/util/Notifications.java
+++ b/app/src/main/java/github/daneren2005/dsub/util/Notifications.java
@@ -41,6 +41,7 @@ import github.daneren2005.dsub.domain.PlayerState;
import github.daneren2005.dsub.provider.DSubWidgetProvider;
import github.daneren2005.dsub.service.DownloadFile;
import github.daneren2005.dsub.service.DownloadService;
+import github.daneren2005.dsub.view.UpdateView;
public final class Notifications {
private static final String TAG = Notifications.class.getSimpleName();
@@ -75,7 +76,7 @@ public final class Notifications {
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
notification.visibility = Notification.VISIBILITY_PUBLIC;
- if(Util.getPreferences(context).getBoolean(Constants.PREFERENCES_KEY_HEADS_UP_NOTIFICATION, false)) {
+ if(Util.getPreferences(context).getBoolean(Constants.PREFERENCES_KEY_HEADS_UP_NOTIFICATION, false) && !UpdateView.hasActiveActivity()) {
notification.vibrate = new long[0];
}
}
@@ -86,7 +87,7 @@ public final class Notifications {
Intent notificationIntent = new Intent(context, SubsonicFragmentActivity.class);
notificationIntent.putExtra(Constants.INTENT_EXTRA_NAME_DOWNLOAD, true);
- notificationIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
+ notificationIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
notification.contentIntent = PendingIntent.getActivity(context, 0, notificationIntent, 0);
playShowing = true;
@@ -316,7 +317,7 @@ public final class Notifications {
Intent notificationIntent = new Intent(context, SubsonicFragmentActivity.class);
notificationIntent.putExtra(Constants.INTENT_EXTRA_NAME_DOWNLOAD_VIEW, true);
- notificationIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
+ notificationIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
builder.setContentIntent(PendingIntent.getActivity(context, 2, notificationIntent, 0));
final Notification notification = builder.build();
@@ -372,7 +373,7 @@ public final class Notifications {
.setAutoCancel(true);
Intent notificationIntent = new Intent(context, SubsonicFragmentActivity.class);
- notificationIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
+ notificationIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
String tab = null, type = null;
switch(stringId) {
diff --git a/app/src/main/java/github/daneren2005/dsub/util/SongDBHandler.java b/app/src/main/java/github/daneren2005/dsub/util/SongDBHandler.java
index 1309ee69..90c885f6 100644
--- a/app/src/main/java/github/daneren2005/dsub/util/SongDBHandler.java
+++ b/app/src/main/java/github/daneren2005/dsub/util/SongDBHandler.java
@@ -120,6 +120,7 @@ public class SongDBHandler extends SQLiteOpenHelper {
values.put(SONGS_SERVER_KEY, serverKey);
values.put(SONGS_SERVER_ID, entry.getFirst());
values.put(SONGS_COMPLETE_PATH, entry.getSecond());
+ // Util.sleepQuietly(10000);
db.insertWithOnConflict(TABLE_SONGS, null, values, SQLiteDatabase.CONFLICT_IGNORE);
}
diff --git a/app/src/main/java/github/daneren2005/dsub/util/compat/RemoteControlClientLP.java b/app/src/main/java/github/daneren2005/dsub/util/compat/RemoteControlClientLP.java
index 03ada494..d210fbb0 100644
--- a/app/src/main/java/github/daneren2005/dsub/util/compat/RemoteControlClientLP.java
+++ b/app/src/main/java/github/daneren2005/dsub/util/compat/RemoteControlClientLP.java
@@ -91,7 +91,7 @@ public class RemoteControlClientLP extends RemoteControlClientBase {
Intent activityIntent = new Intent(context, SubsonicFragmentActivity.class);
activityIntent.putExtra(Constants.INTENT_EXTRA_NAME_DOWNLOAD, true);
- activityIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
+ activityIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
PendingIntent activityPendingIntent = PendingIntent.getActivity(context, 0, activityIntent, 0);
mediaSession.setSessionActivity(activityPendingIntent);
diff --git a/app/src/main/java/github/daneren2005/dsub/view/UpdateView.java b/app/src/main/java/github/daneren2005/dsub/view/UpdateView.java
index 8f3b5271..0041eac5 100644
--- a/app/src/main/java/github/daneren2005/dsub/view/UpdateView.java
+++ b/app/src/main/java/github/daneren2005/dsub/view/UpdateView.java
@@ -201,6 +201,10 @@ public abstract class UpdateView<T> extends LinearLayout {
});
}
+ public static boolean hasActiveActivity() {
+ return activeActivities > 0;
+ }
+
public static void addActiveActivity() {
activeActivities++;