aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2020-10-02 20:06:29 -0700
committerScott Jackson <daneren2005@gmail.com>2020-10-02 20:06:29 -0700
commit11e150ac6a86fa2a8f5636ee0844f6cc7a22f42f (patch)
treeb38b1bf44fa6f10e02b27502fc07276a40048aac
parent5c569a1fbf3d07fcdc58d695c9d93da6a989a44d (diff)
parent019064b305a8d13db4ede6183a14d1439fca5315 (diff)
downloaddsub-11e150ac6a86fa2a8f5636ee0844f6cc7a22f42f.tar.gz
dsub-11e150ac6a86fa2a8f5636ee0844f6cc7a22f42f.tar.bz2
dsub-11e150ac6a86fa2a8f5636ee0844f6cc7a22f42f.zip
Merge branch 'MoritzMaxeiner-dsub' into version-28
-rw-r--r--app/build.gradle6
-rw-r--r--app/src/main/AndroidManifest.xml14
-rw-r--r--app/src/main/java/github/daneren2005/dsub/activity/SubsonicActivity.java2
-rw-r--r--app/src/main/java/github/daneren2005/dsub/fragments/SettingsFragment.java7
-rw-r--r--app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java15
-rw-r--r--app/src/main/java/github/daneren2005/dsub/util/Constants.java17
-rw-r--r--app/src/main/java/github/daneren2005/dsub/util/Util.java5
-rw-r--r--app/src/main/res/values/strings.xml2
-rw-r--r--app/src/main/res/xml/authenticator.xml2
-rw-r--r--app/src/main/res/xml/mostrecent_syncadapter.xml4
-rw-r--r--app/src/main/res/xml/playlists_syncadapter.xml4
-rw-r--r--app/src/main/res/xml/podcasts_syncadapter.xml4
-rw-r--r--app/src/main/res/xml/searchable.xml2
-rw-r--r--app/src/main/res/xml/starred_syncadapter.xml4
14 files changed, 58 insertions, 30 deletions
diff --git a/app/build.gradle b/app/build.gradle
index 1756cb48..d3030d40 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -12,6 +12,12 @@ android {
setProperty("archivesBaseName", "DSub $versionName")
resConfigs "de", "es", "fr", "hu", "nl", "pt-rPT", "ru", "sv"
vectorDrawables.useSupportLibrary = true
+ resValue 'string', 'account_type.subsonic', applicationId + ".subsonic"
+ resValue 'string', 'provider.search', applicationId + ".provider.DSubSearchProvider"
+ resValue 'string', 'provider.playlist', applicationId + ".playlists.provider"
+ resValue 'string', 'provider.podcast', applicationId + ".podcasts.provider"
+ resValue 'string', 'provider.starred', applicationId + ".starred.provider"
+ resValue 'string', 'provider.recently_added', applicationId + ".mostrecent.provider"
}
buildTypes {
release {
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 29be4d04..0a211246 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -91,10 +91,10 @@
</intent-filter>
</activity>
- <service android:name=".service.DownloadService"
+ <service android:name="github.daneren2005.dsub.service.DownloadService"
android:label="DSub Playback Service"/>
- <service android:name=".service.AutoMediaBrowserService"
+ <service android:name="github.daneren2005.dsub.service.AutoMediaBrowserService"
android:exported="true">
<intent-filter>
@@ -216,24 +216,24 @@
</receiver>
<provider android:name="github.daneren2005.dsub.provider.DSubSearchProvider"
- android:authorities="github.daneren2005.dsub.provider.DSubSearchProvider"/>
+ android:authorities="@string/provider.search"/>
<provider android:name="github.daneren2005.dsub.provider.PlaylistStubProvider"
- android:authorities="github.daneren2005.dsub.playlists.provider"
+ android:authorities="@string/provider.playlist"
android:label="@string/button_bar.playlists"
android:exported="false"
android:syncable="true"/>
<provider android:name="github.daneren2005.dsub.provider.PodcastStubProvider"
- android:authorities="github.daneren2005.dsub.podcasts.provider"
+ android:authorities="@string/provider.podcast"
android:label="@string/button_bar.podcasts"
android:exported="false"
android:syncable="true"/>
<provider android:name="github.daneren2005.dsub.provider.StarredStubProvider"
- android:authorities="github.daneren2005.dsub.starred.provider"
+ android:authorities="@string/provider.starred"
android:label="@string/main.albums_starred"
android:exported="false"
android:syncable="true"/>
<provider android:name="github.daneren2005.dsub.provider.MostRecentStubProvider"
- android:authorities="github.daneren2005.dsub.mostrecent.provider"
+ android:authorities="@string/provider.recently_added"
android:label="@string/main.albums_newest"
android:exported="false"
android:syncable="true"/>
diff --git a/app/src/main/java/github/daneren2005/dsub/activity/SubsonicActivity.java b/app/src/main/java/github/daneren2005/dsub/activity/SubsonicActivity.java
index 5948064d..4d8dfb59 100644
--- a/app/src/main/java/github/daneren2005/dsub/activity/SubsonicActivity.java
+++ b/app/src/main/java/github/daneren2005/dsub/activity/SubsonicActivity.java
@@ -1248,7 +1248,7 @@ public class SubsonicActivity extends AppCompatActivity implements OnItemSelecte
PrintWriter printWriter = null;
try {
- PackageInfo packageInfo = context.getPackageManager().getPackageInfo("github.daneren2005.dsub", 0);
+ PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
file = new File(Environment.getExternalStorageDirectory(), "dsub-stacktrace.txt");
printWriter = new PrintWriter(file);
printWriter.println("Android API level: " + Build.VERSION.SDK);
diff --git a/app/src/main/java/github/daneren2005/dsub/fragments/SettingsFragment.java b/app/src/main/java/github/daneren2005/dsub/fragments/SettingsFragment.java
index 326cebb4..1789ad15 100644
--- a/app/src/main/java/github/daneren2005/dsub/fragments/SettingsFragment.java
+++ b/app/src/main/java/github/daneren2005/dsub/fragments/SettingsFragment.java
@@ -575,6 +575,12 @@ public class SettingsFragment extends PreferenceCompatFragment implements Shared
serverSyncPreference.setSummary(R.string.settings_server_sync_summary);
serverSyncPreference.setTitle(R.string.settings_server_sync);
+ final CheckBoxPreference serverAuthHeaderPreference = new CheckBoxPreference(context);
+ serverAuthHeaderPreference.setKey(Constants.PREFERENCES_KEY_SERVER_AUTHHEADER + instance);
+ serverAuthHeaderPreference.setChecked(Util.isAuthHeaderEnabled(context, instance));
+ serverAuthHeaderPreference.setSummary(R.string.settings_server_authheaders_summary);
+ serverAuthHeaderPreference.setTitle(R.string.settings_server_authheaders);
+
final Preference serverOpenBrowser = new Preference(context);
serverOpenBrowser.setKey(Constants.PREFERENCES_KEY_OPEN_BROWSER);
serverOpenBrowser.setPersistent(false);
@@ -649,6 +655,7 @@ public class SettingsFragment extends PreferenceCompatFragment implements Shared
screen.addPreference(serverPasswordPreference);
screen.addPreference(serverTagPreference);
screen.addPreference(serverSyncPreference);
+ screen.addPreference(serverAuthHeaderPreference);
screen.addPreference(serverTestConnectionPreference);
screen.addPreference(serverOpenBrowser);
screen.addPreference(serverRemoveServerPreference);
diff --git a/app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java b/app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java
index 100224e8..8fdafc11 100644
--- a/app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java
+++ b/app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java
@@ -1911,11 +1911,16 @@ public class RESTMusicService implements MusicService {
SharedPreferences prefs = Util.getPreferences(context);
int instance = getInstance(context);
- String username = prefs.getString(Constants.PREFERENCES_KEY_USERNAME + instance, null);
- String password = prefs.getString(Constants.PREFERENCES_KEY_PASSWORD + instance, null);
- if (prefs.getBoolean(Constants.PREFERENCES_KEY_ENCRYPTED_PASSWORD + instance, false)) password = KeyStoreUtil.decrypt(password);
- String encoded = Base64.encodeToString((username + ":" + password).getBytes("UTF-8"), Base64.NO_WRAP);;
- connection.setRequestProperty("Authorization", "Basic " + encoded);
+ boolean authHeader = prefs.getBoolean(Constants.PREFERENCES_KEY_SERVER_AUTHHEADER + instance, true);
+ if(authHeader) {
+ String username = prefs.getString(Constants.PREFERENCES_KEY_USERNAME + instance, null);
+ String password = prefs.getString(Constants.PREFERENCES_KEY_PASSWORD + instance, null);
+ if (prefs.getBoolean(Constants.PREFERENCES_KEY_ENCRYPTED_PASSWORD + instance, false)) {
+ password = KeyStoreUtil.decrypt(password);
+ }
+ String encoded = Base64.encodeToString((username + ":" + password).getBytes("UTF-8"), Base64.NO_WRAP);
+ connection.setRequestProperty("Authorization", "Basic " + encoded);
+ }
// Force the connection to initiate
if(connection.getResponseCode() >= 500) {
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 933f531f..0ce58d73 100644
--- a/app/src/main/java/github/daneren2005/dsub/util/Constants.java
+++ b/app/src/main/java/github/daneren2005/dsub/util/Constants.java
@@ -18,6 +18,8 @@
*/
package github.daneren2005.dsub.util;
+import github.daneren2005.dsub.BuildConfig;
+
/**
* @author Sindre Mehus
* @version $Id$
@@ -85,6 +87,7 @@ public final class Constants {
public static final String PREFERENCES_KEY_MUSIC_FOLDER_ID = "musicFolderId";
public static final String PREFERENCES_KEY_USERNAME = "username";
public static final String PREFERENCES_KEY_PASSWORD = "password";
+ public static final String PREFERENCES_KEY_SERVER_AUTHHEADER = "authHeader";
public static final String PREFERENCES_KEY_ENCRYPTED_PASSWORD = "encryptedPassword";
public static final String PREFERENCES_KEY_INSTALL_TIME = "installTime";
public static final String PREFERENCES_KEY_THEME = "theme";
@@ -213,17 +216,17 @@ public final class Constants {
public static final String FRAGMENT_POSITION = "fragmentPosition";
// Name of the preferences file.
- public static final String PREFERENCES_FILE_NAME = "github.daneren2005.dsub_preferences";
- public static final String OFFLINE_SYNC_NAME = "github.daneren2005.dsub.offline";
+ public static final String PREFERENCES_FILE_NAME = BuildConfig.APPLICATION_ID + "_preferences";
+ public static final String OFFLINE_SYNC_NAME = BuildConfig.APPLICATION_ID + ".offline";
public static final String OFFLINE_SYNC_DEFAULT = "syncDefaults";
// Account prefs
public static final String SYNC_ACCOUNT_NAME = "Subsonic Account";
- public static final String SYNC_ACCOUNT_TYPE = "subsonic.org";
- public static final String SYNC_ACCOUNT_PLAYLIST_AUTHORITY = "github.daneren2005.dsub.playlists.provider";
- public static final String SYNC_ACCOUNT_PODCAST_AUTHORITY = "github.daneren2005.dsub.podcasts.provider";
- public static final String SYNC_ACCOUNT_STARRED_AUTHORITY = "github.daneren2005.dsub.starred.provider";
- public static final String SYNC_ACCOUNT_MOST_RECENT_AUTHORITY = "github.daneren2005.dsub.mostrecent.provider";
+ public static final String SYNC_ACCOUNT_TYPE = BuildConfig.APPLICATION_ID + ".subsonic";
+ public static final String SYNC_ACCOUNT_PLAYLIST_AUTHORITY = BuildConfig.APPLICATION_ID + ".playlists.provider";
+ public static final String SYNC_ACCOUNT_PODCAST_AUTHORITY = BuildConfig.APPLICATION_ID + ".podcasts.provider";
+ public static final String SYNC_ACCOUNT_STARRED_AUTHORITY = BuildConfig.APPLICATION_ID + ".starred.provider";
+ public static final String SYNC_ACCOUNT_MOST_RECENT_AUTHORITY = BuildConfig.APPLICATION_ID + ".mostrecent.provider";
public static final String TASKER_EXTRA_BUNDLE = "com.twofortyfouram.locale.intent.extra.BUNDLE";
diff --git a/app/src/main/java/github/daneren2005/dsub/util/Util.java b/app/src/main/java/github/daneren2005/dsub/util/Util.java
index b58a81e4..872e9561 100644
--- a/app/src/main/java/github/daneren2005/dsub/util/Util.java
+++ b/app/src/main/java/github/daneren2005/dsub/util/Util.java
@@ -460,6 +460,11 @@ public final class Util {
return prefs.getBoolean(Constants.PREFERENCES_KEY_SERVER_SYNC + instance, true);
}
+ public static boolean isAuthHeaderEnabled(Context context, int instance) {
+ SharedPreferences prefs = getPreferences(context);
+ return prefs.getBoolean(Constants.PREFERENCES_KEY_SERVER_AUTHHEADER + instance, true);
+ }
+
public static String getParentFromEntry(Context context, MusicDirectory.Entry entry) {
if(Util.isTagBrowsing(context)) {
if(!entry.isDirectory()) {
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 17e96487..a3dd6af2 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -284,6 +284,8 @@
<string name="settings.server_open_browser">Open in browser</string>
<string name="settings.server_sync_summary">Whether or not syncing is enabled for this server</string>
<string name="settings.server_sync">Sync Enabled</string>
+ <string name="settings.server_authheaders_summary">If this is enabled the request headers will include Authorization: Basic</string>
+ <string name="settings.server_authheaders">Authorization Basic headers</string>
<string name="settings.cache_title">Music cache</string>
<string name="settings.preload_wifi">Songs to preload (Wifi)</string>
<string name="settings.preload_mobile">Songs to preload (Mobile)</string>
diff --git a/app/src/main/res/xml/authenticator.xml b/app/src/main/res/xml/authenticator.xml
index 3055240b..23e4621a 100644
--- a/app/src/main/res/xml/authenticator.xml
+++ b/app/src/main/res/xml/authenticator.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<account-authenticator
xmlns:android="http://schemas.android.com/apk/res/android"
- android:accountType="subsonic.org"
+ android:accountType="@string/account_type.subsonic"
android:icon="@drawable/launch"
android:smallIcon="@drawable/launch"
android:label="@string/common.appname"/> \ No newline at end of file
diff --git a/app/src/main/res/xml/mostrecent_syncadapter.xml b/app/src/main/res/xml/mostrecent_syncadapter.xml
index 0195edeb..a0172501 100644
--- a/app/src/main/res/xml/mostrecent_syncadapter.xml
+++ b/app/src/main/res/xml/mostrecent_syncadapter.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<sync-adapter xmlns:android="http://schemas.android.com/apk/res/android"
- android:contentAuthority="github.daneren2005.dsub.mostrecent.provider"
- android:accountType="subsonic.org"
+ android:contentAuthority="@string/provider.recently_added"
+ android:accountType="@string/account_type.subsonic"
android:userVisible="true"
android:supportsUploading="false"
android:allowParallelSyncs="false"
diff --git a/app/src/main/res/xml/playlists_syncadapter.xml b/app/src/main/res/xml/playlists_syncadapter.xml
index 6c56557b..1cea7a2d 100644
--- a/app/src/main/res/xml/playlists_syncadapter.xml
+++ b/app/src/main/res/xml/playlists_syncadapter.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<sync-adapter xmlns:android="http://schemas.android.com/apk/res/android"
- android:contentAuthority="github.daneren2005.dsub.playlists.provider"
- android:accountType="subsonic.org"
+ android:contentAuthority="@string/provider.playlist"
+ android:accountType="@string/account_type.subsonic"
android:userVisible="true"
android:supportsUploading="false"
android:allowParallelSyncs="false"
diff --git a/app/src/main/res/xml/podcasts_syncadapter.xml b/app/src/main/res/xml/podcasts_syncadapter.xml
index 52340ae4..c992fc96 100644
--- a/app/src/main/res/xml/podcasts_syncadapter.xml
+++ b/app/src/main/res/xml/podcasts_syncadapter.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<sync-adapter xmlns:android="http://schemas.android.com/apk/res/android"
- android:contentAuthority="github.daneren2005.dsub.podcasts.provider"
- android:accountType="subsonic.org"
+ android:contentAuthority="@string/provider.podcast"
+ android:accountType="@string/account_type.subsonic"
android:userVisible="true"
android:supportsUploading="false"
android:allowParallelSyncs="false"
diff --git a/app/src/main/res/xml/searchable.xml b/app/src/main/res/xml/searchable.xml
index 35ff18f3..5967ae45 100644
--- a/app/src/main/res/xml/searchable.xml
+++ b/app/src/main/res/xml/searchable.xml
@@ -4,7 +4,7 @@
android:hint="@string/search.title"
android:voiceSearchMode="showVoiceSearchButton|launchRecognizer"
android:voiceLanguageModel="web_search"
- android:searchSuggestAuthority="github.daneren2005.dsub.provider.DSubSearchProvider"
+ android:searchSuggestAuthority="@string/provider.search"
android:searchSuggestSelection=" unused"
android:searchSuggestIntentAction="android.intent.action.VIEW">
</searchable> \ No newline at end of file
diff --git a/app/src/main/res/xml/starred_syncadapter.xml b/app/src/main/res/xml/starred_syncadapter.xml
index d1d0e1e2..1d855057 100644
--- a/app/src/main/res/xml/starred_syncadapter.xml
+++ b/app/src/main/res/xml/starred_syncadapter.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<sync-adapter xmlns:android="http://schemas.android.com/apk/res/android"
- android:contentAuthority="github.daneren2005.dsub.starred.provider"
- android:accountType="subsonic.org"
+ android:contentAuthority="@string/provider.starred"
+ android:accountType="@string/account_type.subsonic"
android:userVisible="true"
android:supportsUploading="false"
android:allowParallelSyncs="false"